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:
parent
5f5f3b7766
commit
d54996dbba
1 changed files with 6 additions and 3 deletions
|
@ -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 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue