X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/68d4172048cfc0f3e658ef90ff5af926eedfdd57..d3017584ba511936444abd5a2400e0519f35416f:/src/msw/thread.cpp?ds=sidebyside diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index d59a960162..7c66077a99 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -10,7 +10,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "thread.h" #endif @@ -64,10 +64,13 @@ (defined(__GNUG__) && defined(__MSVCRT__)) || \ defined(__WATCOMC__) || defined(__MWERKS__) +#ifndef __WXWINCE__ #undef wxUSE_BEGIN_THREAD #define wxUSE_BEGIN_THREAD #endif +#endif + #ifdef wxUSE_BEGIN_THREAD // this is where _beginthreadex() is declared #include @@ -292,6 +295,7 @@ private: wxSemaphoreInternal::wxSemaphoreInternal(int initialcount, int maxcount) { +#ifndef __WXWINCE__ if ( maxcount == 0 ) { // make it practically infinite @@ -305,7 +309,7 @@ wxSemaphoreInternal::wxSemaphoreInternal(int initialcount, int maxcount) maxcount, NULL // no name ); - +#endif if ( !m_semaphore ) { wxLogLastError(_T("CreateSemaphore()")); @@ -344,7 +348,9 @@ wxSemaError wxSemaphoreInternal::WaitTimeout(unsigned long milliseconds) wxSemaError wxSemaphoreInternal::Post() { +#ifndef __WXWINCE__ if ( !::ReleaseSemaphore(m_semaphore, 1, NULL /* ptr to previous count */) ) +#endif { wxLogLastError(_T("ReleaseSemaphore")); @@ -383,6 +389,8 @@ private: wxMutex& m_mutex; wxSemaphore m_semaphore; + + DECLARE_NO_COPY_CLASS(wxConditionInternal) }; wxConditionInternal::wxConditionInternal(wxMutex& mutex) @@ -810,7 +818,15 @@ wxThreadInternal::WaitForTerminate(bool shouldCancel, break; case WAIT_OBJECT_0 + 1: - // new message arrived, process it + // new message arrived, process it -- but only if we're the + // main thread as we don't support processing messages in + // the other ones + // + // NB: we still must include QS_ALLINPUT even when waiting + // in a secondary thread because if it had created some + // window somehow (possible not even using wxWindows) + // the system might dead lock then + if ( wxThread::IsMain() ) { // it looks that sometimes WAIT_OBJECT_0 + 1 is // returned but there are no messages in the thread @@ -952,6 +968,7 @@ unsigned long wxThread::GetCurrentId() bool wxThread::SetConcurrency(size_t level) { +#ifndef __WXWINCE__ wxASSERT_MSG( IsMain(), _T("should only be called from the main thread") ); // ok only for the default one @@ -1041,7 +1058,7 @@ bool wxThread::SetConcurrency(size_t level) return FALSE; } - +#endif return TRUE; }