]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/thread.cpp
use ES_RIGHT|ES_NUMBER styles for the buddy control as it's used for numeric entry...
[wxWidgets.git] / src / os2 / thread.cpp
index bcdd9e1934bdddd3064ddf3b10972e435182f802..f4234f2d85a6500b9786c42e263a59fede7e44d6 100644 (file)
@@ -96,7 +96,8 @@ public:
     bool IsOk() const { return m_vMutex != NULL; }
 
     wxMutexError Lock() { return LockTimeout(SEM_INDEFINITE_WAIT); }
     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:
     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;
 wxMutexError wxMutexInternal::LockTimeout(ULONG ulMilliseconds)
 {
     APIRET                          ulrc;
@@ -136,6 +145,7 @@ wxMutexError wxMutexInternal::LockTimeout(ULONG ulMilliseconds)
     switch (ulrc)
     {
         case ERROR_TIMEOUT:
     switch (ulrc)
     {
         case ERROR_TIMEOUT:
+            return wxMUTEX_TIMEOUT;
         case ERROR_TOO_MANY_SEM_REQUESTS:
             return wxMUTEX_BUSY;
 
         case ERROR_TOO_MANY_SEM_REQUESTS:
             return wxMUTEX_BUSY;