]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/threadpsx.cpp
compilation fix for old SDK headers (such as shipped with VC6)
[wxWidgets.git] / src / unix / threadpsx.cpp
index 2eb63474f914f0ea0ec82daabd9a594e56977c37..d1a8b82f60e5bba27adf8fdc5be592782975541c 100644 (file)
@@ -818,6 +818,7 @@ extern "C" void wxPthreadCleanup(void *ptr)
 
 void wxThreadInternal::Cleanup(wxThread *thread)
 {
+    if (pthread_getspecific(gs_keySelf) == 0) return;
     {
         wxCriticalSectionLocker lock(thread->m_critsect);
         if ( thread->m_internal->GetState() == STATE_EXITED )
@@ -1481,6 +1482,7 @@ void wxThread::Exit(ExitCode status)
         //       we make it a global object, but this would mean that we can
         //       only call one thread function at a time :-(
         DeleteThread(this);
+        pthread_setspecific(gs_keySelf, 0);
     }
     else
     {