Added thread-local declaration. Replace sleep with usleep.

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1051 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
rich_sposato 2009-11-02 22:45:51 +00:00
parent 5f5f3b7766
commit d54996dbba

View file

@ -21,6 +21,9 @@
#include <assert.h> #include <assert.h>
#include <process.h> #include <process.h>
#if !defined( _MSC_VER )
#include <unistd.h> // needed for the usleep function.
#endif
using namespace ::std; using namespace ::std;
@ -36,7 +39,7 @@ using namespace ::std;
#endif #endif
volatile Thread * Thread::s_thread = nullptr; volatile LOKI_THREAD_LOCAL Thread * Thread::s_thread = nullptr;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -94,7 +97,7 @@ bool Thread::WaitForThread( void ) volatile
#if defined( _MSC_VER ) #if defined( _MSC_VER )
::SleepEx( 1, true ); ::SleepEx( 1, true );
#else #else
::sleep( 1 ); ::usleep( 1000 );
#endif #endif
} }
return true; return true;
@ -343,7 +346,7 @@ volatile Thread * ThreadPool::Start( CallFunction function, void * parm ) volati
#if defined( _MSC_VER ) #if defined( _MSC_VER )
::SleepEx( 1, true ); ::SleepEx( 1, true );
#else #else
::sleep( 1 ); ::usleep( 1000 );
#endif #endif
if ( thread->m_status == Thread::Starting ) if ( thread->m_status == Thread::Starting )
{ {