X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5b53617d42b277a87467a0e2721413073fae8641..d581cac5e874ffa151576c61da5e56aca25ab864:/src/msw/thread.cpp diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 6053694909..ee7fec670d 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -21,23 +21,24 @@ #pragma hdrstop #endif +#if wxUSE_THREADS + +#include "wx/thread.h" + #ifndef WX_PRECOMP + #include "wx/msw/missing.h" #include "wx/intl.h" #include "wx/app.h" + #include "wx/module.h" #endif -#if wxUSE_THREADS - #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/module.h" -#include "wx/thread.h" // must have this symbol defined to get _beginthread/_endthread declarations #ifndef _MT @@ -354,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 } // ---------------------------------------------------------------------------- @@ -1381,4 +1390,3 @@ bool WXDLLIMPEXP_BASE wxIsWaitingForThread() #include "wx/thrimpl.cpp" #endif // wxUSE_THREADS -