X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a737331db68b754c8bf31fa0a15f6d1f207b40bf..ea804aadf91c963d97a56e152d8372c9e689affe:/src/unix/threadpsx.cpp?ds=inline diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index ddb603d172..ca1c7731b6 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -47,6 +47,10 @@ #include #endif +#ifdef __WXGTK12__ +#include "gtk/gtk.h" +#endif + // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- @@ -81,8 +85,10 @@ static pthread_t gs_tidMain; // the key for the pointer to the associated wxThread object static pthread_key_t gs_keySelf; +#ifndef __WXGTK12__ // this mutex must be acquired before any call to a GUI function static wxMutex *gs_mutexGui; +#endif // ============================================================================ // implementation @@ -669,10 +675,10 @@ void wxThread::Exit(void *status) // next wake up the threads waiting for us (OTOH, this function won't return // until someone waited for us!) - p_internal->SignalExit(); - p_internal->SetState(STATE_EXITED); + p_internal->SignalExit(); + // delete both C++ thread object and terminate the OS thread object // GL: This is very ugly and buggy ... // delete this; @@ -765,12 +771,15 @@ bool wxThreadModule::OnInit() return FALSE; } +#ifndef __WXGTK12__ gs_mutexGui = new wxMutex(); - - //wxThreadGuiInit(); +#endif gs_tidMain = pthread_self(); + +#ifndef __WXGTK12__ gs_mutexGui->Lock(); +#endif return TRUE; } @@ -789,12 +798,12 @@ void wxThreadModule::OnExit() gs_allThreads[n]->Delete(); } +#ifndef __WXGTK12__ // destroy GUI mutex gs_mutexGui->Unlock(); - //wxThreadGuiExit(); - delete gs_mutexGui; +#endif // and free TLD slot (void)pthread_key_delete(gs_keySelf); @@ -806,12 +815,20 @@ void wxThreadModule::OnExit() void wxMutexGuiEnter() { +#ifdef __WXGTK12__ + gdk_threads_enter(); +#else gs_mutexGui->Lock(); +#endif } void wxMutexGuiLeave() { +#ifdef __WXGTK12__ + gdk_threads_leave(); +#else gs_mutexGui->Unlock(); +#endif } #endif