]> git.saurik.com Git - wxWidgets.git/commitdiff
If the threads module hasn't been initialized yet then we can assume
authorRobin Dunn <robin@alldunn.com>
Tue, 18 May 2004 19:59:18 +0000 (19:59 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 18 May 2004 19:59:18 +0000 (19:59 +0000)
the IsMain == true.  This allows wxASSERTs that happen before the
wxApp is created (as can easily happen in wxPython unfortunatly) to
behave normally instead of just calling wxTrap.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/thread.cpp
src/msw/thread.cpp
src/unix/threadpsx.cpp

index 289a8fa35ea5e6fc3d6f796dbd3003e61e09ee9e..c5ba83d6482a352347bfd96a689eab743567a087 100644 (file)
@@ -1197,7 +1197,7 @@ wxThread *wxThread::This()
 
 bool wxThread::IsMain()
 {
-       return GetCurrentId() == gs_idMainThread;
+       return GetCurrentId() == gs_idMainThread || gs_idMainThread == kNoThreadID;
 }
 
 #ifdef Yield
index 469ced786b44ebabbe4ea8866e854061e55e4e0c..d50ea43a3627e4ac959c31fa8a6cedf0d6800ce6 100644 (file)
@@ -863,7 +863,7 @@ wxThread *wxThread::This()
 
 bool wxThread::IsMain()
 {
-    return ::GetCurrentThreadId() == gs_idMainThread;
+    return ::GetCurrentThreadId() == gs_idMainThread || gs_idMainThread == 0;
 }
 
 void wxThread::Yield()
index ae471b8d6bddb4d4cdf57f8bd19f5b2c8b97e5ec..429b2a292c461b8597199ba668511fbb3f84ddc5 100644 (file)
@@ -113,7 +113,7 @@ WX_DEFINE_ARRAY(wxThread *, wxArrayThread);
 static wxArrayThread gs_allThreads;
 
 // the id of the main thread
-static pthread_t gs_tidMain;
+static pthread_t gs_tidMain = (pthread_t)-1;
 
 // the key for the pointer to the associated wxThread object
 static pthread_key_t gs_keySelf;
@@ -957,7 +957,7 @@ wxThread *wxThread::This()
 
 bool wxThread::IsMain()
 {
-    return (bool)pthread_equal(pthread_self(), gs_tidMain);
+    return (bool)pthread_equal(pthread_self(), gs_tidMain) || gs_tidMain == (pthread_t)-1;
 }
 
 void wxThread::Yield()