From 28a75c297cce08c7c015982fa8a52916af1f9481 Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Sat, 9 Aug 2003 17:08:01 +0000 Subject: [PATCH] Added forgotten(?) wxMutexGuiEnter. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22724 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/thread.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp index 884f66cff4..04ee638e57 100644 --- a/src/os2/thread.cpp +++ b/src/os2/thread.cpp @@ -823,6 +823,28 @@ void WXDLLEXPORT wxWakeUpMainThread() { } +void WXDLLEXPORT wxMutexGuiEnter() +{ + // this would dead lock everything... + wxASSERT_MSG( !wxThread::IsMain(), + wxT("main thread doesn't want to block in wxMutexGuiEnter()!") ); + + // the order in which we enter the critical sections here is crucial!! + + // set the flag telling to the main thread that we want to do some GUI + { + wxCriticalSectionLocker enter(*gs_pCritsectWaitingForGui); + + gs_nWaitingForGui++; + } + + wxWakeUpMainThread(); + + // now we may block here because the main thread will soon let us in + // (during the next iteration of OnIdle()) + gs_pCritsectGui->Enter(); +} + void WXDLLEXPORT wxMutexGuiLeave() { wxCriticalSectionLocker enter(*gs_pCritsectWaitingForGui); -- 2.45.2