]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/thread.cpp
compilation fix for bcc
[wxWidgets.git] / src / msw / thread.cpp
index d59a960162dfcd9362937eff88ed2bc1d6fd93e5..46719dc9c2f35d8f2d0f00006d3ddf2d2ea53fe8 100644 (file)
     (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 <process.h>
@@ -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;
 }