X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b89156b5dbb3c1270452379801a79613cd69bb32..a38b83c353cce75329b2c53c0eaa4ad0f500ccf1:/src/msw/thread.cpp?ds=inline diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 33ca0a645a..a592fbf29e 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -13,6 +13,9 @@ #pragma implementation "thread.h" #endif +// this is here to regen the precompiled header in the ide compile otherwise the +// compiler crashes in vc5 (nfi why) +// For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #if defined(__BORLANDC__) @@ -41,7 +44,7 @@ enum thread_state { ///////////////////////////////////////////////////////////////////////////// static HANDLE p_mainid; -wxMutex wxMainMutex; // controls access to all GUI functions +wxMutex *wxMainMutex; // controls access to all GUI functions ///////////////////////////////////////////////////////////////////////////// // Windows implementation @@ -233,7 +236,7 @@ void wxThread::SetPriority(int prio) p_internal->prio = prio; } -int wxThread::GetPriority() +int wxThread::GetPriority() const { return p_internal->prio; } @@ -257,10 +260,10 @@ void *wxThread::Join() return NULL; if (wxThread::IsMain()) - wxMainMutex.Unlock(); + wxMainMutex->Unlock(); WaitForSingleObject(p_internal->thread_id, INFINITE); if (wxThread::IsMain()) - wxMainMutex.Lock(); + wxMainMutex->Lock(); GetExitCodeThread(p_internal->thread_id, &exit_code); CloseHandle(p_internal->thread_id); @@ -275,7 +278,7 @@ unsigned long wxThread::GetID() const return (unsigned long)p_internal->tid; } -bool wxThread::IsMain() const +bool wxThread::IsMain() { return (GetCurrentThread() == p_mainid); } @@ -307,14 +310,16 @@ class wxThreadModule : public wxModule { DECLARE_DYNAMIC_CLASS(wxThreadModule) public: virtual bool OnInit() { + wxMainMutex = new wxMutex(); p_mainid = GetCurrentThread(); - wxMainMutex.Lock(); + wxMainMutex->Lock(); return TRUE; } // Global cleanup virtual void OnExit() { - wxMainMutex.Unlock(); + wxMainMutex->Unlock(); + delete wxMainMutex; } };