#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__)
/////////////////////////////////////////////////////////////////////////////
static HANDLE p_mainid;
-wxMutex wxMainMutex; // controls access to all GUI functions
+wxMutex *wxMainMutex; // controls access to all GUI functions
/////////////////////////////////////////////////////////////////////////////
// Windows implementation
wxMutex::~wxMutex()
{
+ if (m_locked > 0)
+ wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n", m_locked);
CloseHandle(p_internal->p_mutex);
}
p_internal->prio = prio;
}
-int wxThread::GetPriority()
+int wxThread::GetPriority() const
{
return p_internal->prio;
}
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);
return (unsigned long)p_internal->tid;
}
-bool wxThread::IsMain() const
+bool wxThread::IsMain()
{
return (GetCurrentThread() == p_mainid);
}
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;
}
};