From d54996dbba177e5e32ce89bf9cc5b7e7e53dd650 Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Mon, 2 Nov 2009 22:45:51 +0000 Subject: [PATCH] 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 --- test/LevelMutex/ThreadPool.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/LevelMutex/ThreadPool.cpp b/test/LevelMutex/ThreadPool.cpp index 77f255e..8d30c30 100644 --- a/test/LevelMutex/ThreadPool.cpp +++ b/test/LevelMutex/ThreadPool.cpp @@ -21,6 +21,9 @@ #include #include +#if !defined( _MSC_VER ) + #include // needed for the usleep function. +#endif using namespace ::std; @@ -36,7 +39,7 @@ using namespace ::std; #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 ) ::SleepEx( 1, true ); #else - ::sleep( 1 ); + ::usleep( 1000 ); #endif } return true; @@ -343,7 +346,7 @@ volatile Thread * ThreadPool::Start( CallFunction function, void * parm ) volati #if defined( _MSC_VER ) ::SleepEx( 1, true ); #else - ::sleep( 1 ); + ::usleep( 1000 ); #endif if ( thread->m_status == Thread::Starting ) {