diff options
-rw-r--r-- | src/threadengines/threadengine_pthread.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp index d6b0f3bd7..6a48bd025 100644 --- a/src/threadengines/threadengine_pthread.cpp +++ b/src/threadengines/threadengine_pthread.cpp @@ -44,6 +44,9 @@ void PThreadEngine::Create(Thread* thread_to_init) NewThread->Extend("pthread", MyPThread); Mutex(false); + + while (NewThread) + usleep(1000); } PThreadEngine::~PThreadEngine() @@ -52,7 +55,11 @@ PThreadEngine::~PThreadEngine() void PThreadEngine::Run() { - NewThread->Run(); + Mutex(true); + Thread* nt = NewThread; + NewThread = NULL; + Mutex(false); + nt->Run(); } bool PThreadEngine::Mutex(bool enable) |