]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/thread.cpp
Minor header cleaning.
[wxWidgets.git] / src / msw / thread.cpp
index 9377f181ab572f3dfbec149ecb772ebfef902d42..ee7fec670d7dc528a62ed77011bcc87b246122db 100644 (file)
 #include "wx/thread.h"
 
 #ifndef WX_PRECOMP
 #include "wx/thread.h"
 
 #ifndef WX_PRECOMP
+    #include "wx/msw/missing.h"
     #include "wx/intl.h"
     #include "wx/app.h"
     #include "wx/intl.h"
     #include "wx/app.h"
+    #include "wx/module.h"
 #endif
 
 #include "wx/apptrait.h"
 #include "wx/scopeguard.h"
 
 #include "wx/msw/private.h"
 #endif
 
 #include "wx/apptrait.h"
 #include "wx/scopeguard.h"
 
 #include "wx/msw/private.h"
-#include "wx/msw/missing.h"
 #include "wx/msw/seh.h"
 
 #include "wx/except.h"
 #include "wx/msw/seh.h"
 
 #include "wx/except.h"
-#include "wx/module.h"
 
 // must have this symbol defined to get _beginthread/_endthread declarations
 #ifndef _MT
 
 // must have this symbol defined to get _beginthread/_endthread declarations
 #ifndef _MT
@@ -355,14 +355,22 @@ wxSemaError wxSemaphoreInternal::Post()
 {
 #if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300)
     if ( !::ReleaseSemaphore(m_semaphore, 1, NULL /* ptr to previous count */) )
 {
 #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;
     }
 
     return wxSEMA_NO_ERROR;
+#else
+    return wxSEMA_MISC_ERROR;
+#endif
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------