X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/857f3be5f1e6f20a0c99b839e91d8afd5478e828..5de5db0eb14aa86b5b177050720deb0f4c210fba:/src/gtk1/threadpsx.cpp diff --git a/src/gtk1/threadpsx.cpp b/src/gtk1/threadpsx.cpp index 9623b91c30..2fb5106aa7 100644 --- a/src/gtk1/threadpsx.cpp +++ b/src/gtk1/threadpsx.cpp @@ -19,6 +19,7 @@ #include "wx/thread.h" #include "wx/module.h" #include "wx/utils.h" +#include "wx/log.h" enum thread_state { STATE_IDLE = 0, @@ -37,7 +38,7 @@ static pthread_t p_mainid; static wxMutex p_list_mutex; static wxList p_threads_list; -wxMutex wxMainMutex; // controls access to all GUI functions +wxMutex *wxMainMutex; // controls access to all GUI functions ///////////////////////////////////////////////////////////////////////////// // GUI thread manager @@ -63,8 +64,7 @@ wxMutex::wxMutex() wxMutex::~wxMutex() { if (m_locked > 0) - wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", - m_locked); + wxLogDebug( "wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked ); pthread_mutex_destroy(&(p_internal->p_mutex)); delete p_internal; @@ -288,10 +288,10 @@ void *wxThread::Join() wxYield(); if (do_unlock) - wxMainMutex.Unlock(); + wxMainMutex->Unlock(); pthread_join(p_internal->thread_id, &status); if (do_unlock) - wxMainMutex.Lock(); + wxMainMutex->Lock(); p_list_mutex.Lock(); delete p_threads_list.Nth(p_internal->id); @@ -377,17 +377,19 @@ class wxThreadModule : public wxModule { DECLARE_DYNAMIC_CLASS(wxThreadModule) public: virtual bool OnInit() { + wxMainMutex = new wxMutex(); wxThreadGuiInit(); p_mainid = pthread_self(); - p_threads_list = wxList(wxKEY_INTEGER); - wxMainMutex.Lock(); +// p_threads_list = wxList(wxKEY_INTEGER); + wxMainMutex->Lock(); return TRUE; } virtual void OnExit() { - wxMainMutex.Unlock(); + wxMainMutex->Unlock(); wxThreadGuiExit(); + delete wxMainMutex; } };