]> git.saurik.com Git - wxWidgets.git/commitdiff
make wxSemaphore::Post() return wxSEMA_OVERFLOW as documented (patch 1557642)
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 3 Oct 2006 15:05:40 +0000 (15:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 3 Oct 2006 15:05:40 +0000 (15:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41593 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/thread.cpp

index f302ff648601a0e110bae4933c644c495af041f6..98bd418cc1dc4a29ced9d0caf2d62235c9037f3e 100644 (file)
@@ -76,6 +76,7 @@ All (GUI):
 wxMSW:
 
 - Implemented wxComboBox::SetEditable().
+- wxSemaphore::Post() returns wxSEMA_OVERFLOW as documented (Christian Walther)
 - Fixed a bug whereby static controls didn't use the correct text colour if the
   parent's background colour had been set (most noticeable when switching to a
   high-contrast theme).
index b48ed592cdcd16c9e51853f4b5b3ae965d68961a..ee7fec670d7dc528a62ed77011bcc87b246122db 100644 (file)
@@ -355,14 +355,22 @@ wxSemaError wxSemaphoreInternal::Post()
 {
 #if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300)
     if ( !::ReleaseSemaphore(m_semaphore, 1, NULL /* ptr to previous count */) )
-#endif
     {
-        wxLogLastError(_T("ReleaseSemaphore"));
-
-        return wxSEMA_MISC_ERROR;
+        if ( GetLastError() == ERROR_TOO_MANY_POSTS )
+        {
+            return wxSEMA_OVERFLOW;
+        }
+        else
+        {
+            wxLogLastError(_T("ReleaseSemaphore"));
+            return wxSEMA_MISC_ERROR;
+        }
     }
 
     return wxSEMA_NO_ERROR;
+#else
+    return wxSEMA_MISC_ERROR;
+#endif
 }
 
 // ----------------------------------------------------------------------------