added wxIsMainThread()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -596,6 +596,10 @@ void WXDLLEXPORT wxMutexGuiLeave();
|
|||||||
#define wxCRIT_SECT_DECLARE(cs) static wxCriticalSection cs
|
#define wxCRIT_SECT_DECLARE(cs) static wxCriticalSection cs
|
||||||
#define wxCRIT_SECT_LOCKER(name, cs) wxCriticalSectionLocker name(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
|
#else // !wxUSE_THREADS
|
||||||
|
|
||||||
// no thread support
|
// no thread support
|
||||||
@@ -609,6 +613,9 @@ inline void WXDLLEXPORT wxMutexGuiLeave() { }
|
|||||||
#define wxCRIT_SECT_DECLARE(cs)
|
#define wxCRIT_SECT_DECLARE(cs)
|
||||||
#define wxCRIT_SECT_LOCKER(name, 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
|
#endif // wxUSE_THREADS/!wxUSE_THREADS
|
||||||
|
|
||||||
// mark part of code as being a critical section: this macro declares a
|
// mark part of code as being a critical section: this macro declares a
|
||||||
|
Reference in New Issue
Block a user