]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/thread.cpp
Various fixes.
[wxWidgets.git] / src / msw / thread.cpp
index f133213341bd9e3a445bb77bbcc6d36eb1ea6056..a592fbf29ec0740e73d4556b0aec85195f6ae230 100644 (file)
@@ -13,6 +13,8 @@
 #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"
 
@@ -42,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
@@ -258,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);
@@ -308,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;
   }
 };