]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/thread.cpp
added wxListView class: this is going to be a wxListCtrl with human (inter)face
[wxWidgets.git] / src / msw / thread.cpp
index 66efdf36ac33b01ec87a1a4c6c68611cebeef763..f76f9a4c7bb4d848d0c2aa83d4afbbdcc929dbfe 100644 (file)
@@ -257,10 +257,15 @@ public:
 
     void Broadcast()
     {
 
     void Broadcast()
     {
+        // we need to save the original value as m_nWaiters is goign to be
+        // decreased by the signalled thread resulting in the loop being
+        // executed less times than needed
+        LONG nWaiters = m_nWaiters;
+
         // this works because all these threads are already waiting and so each
         // SetEvent() inside Signal() is really a PulseEvent() because the
         // event state is immediately returned to non-signaled
         // this works because all these threads are already waiting and so each
         // SetEvent() inside Signal() is really a PulseEvent() because the
         // event state is immediately returned to non-signaled
-        for ( LONG n = 0; n < m_nWaiters; n++ )
+        for ( LONG n = 0; n < nWaiters; n++ )
         {
             Signal();
         }
         {
             Signal();
         }
@@ -322,8 +327,14 @@ void wxCondition::Broadcast()
 
 wxCriticalSection::wxCriticalSection()
 {
 
 wxCriticalSection::wxCriticalSection()
 {
-    wxASSERT_MSG( sizeof(CRITICAL_SECTION) <= sizeof(m_buffer),
+#ifdef __WXDEBUG__
+    // Done this way to stop warnings during compilation about statement
+    // always being false
+        int csSize = sizeof(CRITICAL_SECTION);
+        int bSize  = sizeof(m_buffer);
+    wxASSERT_MSG( csSize <= bSize,
                   _T("must increase buffer size in wx/thread.h") );
                   _T("must increase buffer size in wx/thread.h") );
+#endif
 
     ::InitializeCriticalSection((CRITICAL_SECTION *)m_buffer);
 }
 
     ::InitializeCriticalSection((CRITICAL_SECTION *)m_buffer);
 }