#19171 move of usleep function to SharedUtil.cpp

This commit is contained in:
vincent 2013-04-10 21:55:29 +02:00
parent 6a5c51bc69
commit d6189694c8
3 changed files with 24 additions and 12 deletions

View file

@ -311,18 +311,6 @@ void AgentList::stopSilentAgentRemovalThread() {
pthread_join(removeSilentAgentsThread, NULL);
}
#ifdef _WIN32
void usleep(int waitTime) {
__int64 time1 = 0, time2 = 0, sysFreq = 0;
QueryPerformanceCounter((LARGE_INTEGER *)&time1);
QueryPerformanceFrequency((LARGE_INTEGER *)&sysFreq);
do {
QueryPerformanceCounter((LARGE_INTEGER *)&time2);
} while( (time2 - time1) < waitTime);
}
#endif
void *checkInWithDomainServer(void *args) {
AgentList *parentAgentList = (AgentList *)args;

View file

@ -9,6 +9,9 @@
#include <cstdlib>
#include <cstdio>
#include <cstring>
#ifdef _WIN32
#include "Syssocket.h"
#endif
#include "SharedUtil.h"
#include "OctalCode.h"
@ -16,6 +19,11 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
#ifdef _WIN32
#endif
double usecTimestamp(timeval *time) {
return (time->tv_sec * 1000000.0 + time->tv_usec);
}
@ -336,3 +344,15 @@ void printVoxelCode(unsigned char* voxelCode) {
outputBits(voxelCode[i]);
}
}
#ifdef _WIN32
void usleep(int waitTime) {
__int64 time1 = 0, time2 = 0, sysFreq = 0;
QueryPerformanceCounter((LARGE_INTEGER *)&time1);
QueryPerformanceFrequency((LARGE_INTEGER *)&sysFreq);
do {
QueryPerformanceCounter((LARGE_INTEGER *)&time2);
} while( (time2 - time1) < waitTime);
}
#endif

View file

@ -50,4 +50,8 @@ unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r,
bool createVoxelEditMessage(unsigned char command, short int sequence,
int voxelCount, VoxelDetail* voxelDetails, unsigned char*& bufferOut, int& sizeOut);
#ifdef _WIN32
void usleep(int waitTime);
#endif
#endif /* defined(__hifi__SharedUtil__) */