X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bac507e062ea3633b1e6bc8aae7733c2df4c48cd..c9057ae1c565cc4ae6c2cf84dd19d65a64ee2b7b:/include/wx/thread.h diff --git a/include/wx/thread.h b/include/wx/thread.h index 7e0dc5997f..c47aca3449 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -350,14 +350,26 @@ private: void WXDLLEXPORT wxMutexGuiEnter(); void WXDLLEXPORT wxMutexGuiLeave(); +// macros for entering/leaving critical sections which may be used without +// having to take them inside "#if wxUSE_THREADS" +#define wxENTER_CRIT_SECT(cs) (cs)->Enter() +#define wxLEAVE_CRIT_SECT(cs) (cs)->Leave() +#define wxCRIT_SECT_LOCKER(name, cs) wxCriticalSectionLocker name(*cs) + #else // !wxUSE_THREADS -#include // for WXDLLEXPORT +#include "wx/defs.h" // for WXDLLEXPORT // no thread support inline void WXDLLEXPORT wxMutexGuiEnter() { } inline void WXDLLEXPORT wxMutexGuiLeave() { } +// macros for entering/leaving critical sections which may be used without +// having to take them inside "#if wxUSE_THREADS" +#define wxENTER_CRIT_SECT(cs) +#define wxLEAVE_CRIT_SECT(cs) +#define wxCRIT_SECT_LOCKER(name, cs) + #endif // wxUSE_THREADS // automatically unlock GUI mutex in dtor