iOS platform and Android don't have __thread local storage, so avoid multi-threaded profiler on those (only on _WIN32, __linux__ and __APPLE__ and not TARGET_OS_IPHONE

Add a Sleep(0) for Windows to yield threads (and not Sleep(1))
This commit is contained in:
Erwin Coumans
2017-01-08 12:49:04 -08:00
parent 04d78cccfb
commit 5e6cfd70b5
9 changed files with 127 additions and 77 deletions

View File

@@ -187,12 +187,16 @@ double b3Clock::getTimeInSeconds()
void b3Clock::usleep(int microSeconds)
{
#ifdef _WIN32
int millis = microSeconds/1000;
if (millis < 1)
if (microSeconds==0)
{
millis = 1;
Sleep(0);
} else
{
int millis = microSeconds/1000;
if (millis<1)
millis=1;
Sleep(millis);
}
Sleep(millis);
#else
::usleep(microSeconds);