]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/thread.cpp
fix making base for watcom (lib\base and console sample now compile)
[wxWidgets.git] / src / msw / thread.cpp
index cf2353b6157b7d5f7386936d10f2346c221490a6..df5f2f2ba7b2f6d478c955e8be458afe63f169cf 100644 (file)
@@ -267,7 +267,16 @@ public:
     bool IsOk() const { return m_semaphore != NULL; }
 
     wxSemaError Wait() { return WaitTimeout(INFINITE); }
-    wxSemaError TryWait() { return WaitTimeout(0); }
+
+    wxSemaError TryWait()
+    {
+        wxSemaError rc = WaitTimeout(0);
+        if ( rc == wxSEMA_TIMEOUT )
+            rc = wxSEMA_BUSY;
+
+        return rc;
+    }
+
     wxSemaError WaitTimeout(unsigned long milliseconds);
 
     wxSemaError Post();
@@ -321,7 +330,7 @@ wxSemaError wxSemaphoreInternal::WaitTimeout(unsigned long milliseconds)
            return wxSEMA_NO_ERROR;
 
         case WAIT_TIMEOUT:
-           return wxSEMA_BUSY;
+           return wxSEMA_TIMEOUT;
 
         default:
             wxLogLastError(_T("WaitForSingleObject(semaphore)"));
@@ -620,6 +629,9 @@ void wxThreadInternal::SetPriority(unsigned int priority)
 
 bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize)
 {
+    wxASSERT_MSG( m_state == STATE_NEW && !m_hThread,
+                    _T("Create()ing thread twice?") );
+
     // for compilers which have it, we should use C RTL function for thread
     // creation instead of Win32 API one because otherwise we will have memory
     // leaks if the thread uses C RTL (and most threads do)