From 17dbd23000b42be970a39e2b2fd775721be7f090 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 29 Jun 2003 11:51:17 +0000 Subject: [PATCH] added wxIsMainThread() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/thread.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/wx/thread.h b/include/wx/thread.h index 319f17c75d..c91ab229af 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -596,6 +596,10 @@ void WXDLLEXPORT wxMutexGuiLeave(); #define wxCRIT_SECT_DECLARE(cs) static wxCriticalSection cs #define wxCRIT_SECT_LOCKER(name, cs) wxCriticalSectionLocker name(cs) +// function for checking if we're in the main thread which may be used whether +// wxUSE_THREADS is 0 or 1 +inline bool wxIsMainThread() { return wxThread::IsMain(); } + #else // !wxUSE_THREADS // no thread support @@ -609,6 +613,9 @@ inline void WXDLLEXPORT wxMutexGuiLeave() { } #define wxCRIT_SECT_DECLARE(cs) #define wxCRIT_SECT_LOCKER(name, cs) +// if there is only one thread, it is always the main one +inline bool wxIsMainThread() { return true; } + #endif // wxUSE_THREADS/!wxUSE_THREADS // mark part of code as being a critical section: this macro declares a -- 2.45.2