X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/670f9935630beb2123a5ca62894ae92a3f0efa4f..180b5b4827d08f1ac13bbb5eca03f775ab35a0b1:/src/os2/thread.cpp diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp index 3274b8ef57..f4234f2d85 100644 --- a/src/os2/thread.cpp +++ b/src/os2/thread.cpp @@ -24,10 +24,10 @@ #include "wx/intl.h" #include "wx/log.h" #include "wx/app.h" + #include "wx/module.h" #endif //WX_PRECOMP #include "wx/apptrait.h" -#include "wx/module.h" #include "wx/utils.h" #include @@ -96,7 +96,8 @@ public: bool IsOk() const { return m_vMutex != NULL; } wxMutexError Lock() { return LockTimeout(SEM_INDEFINITE_WAIT); } - wxMutexError TryLock() { return LockTimeout(SEM_IMMEDIATE_RETURN); } + wxMutexError Lock(unsigned long ms) { return LockTimeout(ms); } + wxMutexError TryLock(); wxMutexError Unlock(); private: @@ -127,6 +128,14 @@ wxMutexInternal::~wxMutexInternal() } } +wxMutexError wxMutexInternal::TryLock() +{ + const wxMutexError rc = LockTimeout( SEM_IMMEDIATE_RETURN ); + + // we have a special return code for timeout in this case + return rc == wxMUTEX_TIMEOUT ? wxMUTEX_BUSY : rc; +} + wxMutexError wxMutexInternal::LockTimeout(ULONG ulMilliseconds) { APIRET ulrc; @@ -136,6 +145,7 @@ wxMutexError wxMutexInternal::LockTimeout(ULONG ulMilliseconds) switch (ulrc) { case ERROR_TIMEOUT: + return wxMUTEX_TIMEOUT; case ERROR_TOO_MANY_SEM_REQUESTS: return wxMUTEX_BUSY;