Fixed thread sleep time to avoid sleeping 0ms when requested a positive value less then 1000us (Windows only).

git-svn-id: http://yate.null.ro/svn/yate/trunk@2182 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2008-09-04 13:30:17 +00:00
parent 18a6b5bf79
commit c7620ef2e6
1 changed files with 6 additions and 1 deletions

View File

@ -601,7 +601,12 @@ void Thread::msleep(unsigned long msec, bool exitCheck)
void Thread::usleep(unsigned long usec, bool exitCheck)
{
#ifdef _WINDOWS
::Sleep(usec/1000);
if (usec) {
usec = (usec + 500) / 1000;
if (!usec)
usec = 1;
}
::Sleep(usec);
#else
::usleep(usec);
#endif