]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/thread.cpp
copy item text for app menu items from wx menus
[wxWidgets.git] / src / osx / carbon / thread.cpp
index 0aa6d3939ccd18c3307ab91c4c7fbd77656e073c..3a55879a54ae34ce6c79db2fbfc3a5ee88d5f11f 100644 (file)
@@ -49,7 +49,7 @@ enum wxThreadState
 // ----------------------------------------------------------------------------
 
 // the task ID of the main thread
-static wxThreadIdType gs_idMainThread = kInvalidID;
+wxThreadIdType wxThread::ms_idMainThread = kInvalidID;
 
 // this is the Per-Task Storage for the pointer to the appropriate wxThread
 TaskStorageIndex gs_tlsForWXThread = 0;
@@ -796,11 +796,6 @@ wxThread *wxThread::This()
     return thr;
 }
 
-bool wxThread::IsMain()
-{
-    return GetCurrentId() == gs_idMainThread || gs_idMainThread == kInvalidID ;
-}
-
 #ifdef Yield
 #undef Yield
 #endif
@@ -848,7 +843,6 @@ wxThread::~wxThread()
 
     g_numberOfThreads--;
 
-#ifdef __WXDEBUG__
     m_critsect.Enter();
 
     // check that the thread either exited or couldn't be created
@@ -861,7 +855,6 @@ wxThread::~wxThread()
     }
 
     m_critsect.Leave();
-#endif
 
     wxDELETE( m_internal ) ;
 }
@@ -900,7 +893,7 @@ wxThreadError wxThread::Run()
 wxThreadError wxThread::Pause()
 {
     wxCHECK_MSG( This() != this, wxTHREAD_MISC_ERROR,
-                 _T("a thread can't pause itself") );
+                 wxT("a thread can't pause itself") );
 
     wxCriticalSectionLocker lock(m_critsect);
 
@@ -1135,14 +1128,14 @@ void wxThread::SetPriority(unsigned int prio)
 
 unsigned int wxThread::GetPriority() const
 {
-    wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect); // const_cast
+    wxCriticalSectionLocker lock(const_cast<wxCriticalSection &>(m_critsect));
 
     return m_internal->GetPriority();
 }
 
 unsigned long wxThread::GetId() const
 {
-    wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect); // const_cast
+    wxCriticalSectionLocker lock(const_cast<wxCriticalSection &>(m_critsect));
 
     return (unsigned long)m_internal->GetId();
 }
@@ -1198,8 +1191,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
 
 bool wxThreadModule::OnInit()
 {
-    bool hasThreadManager = 
-#ifdef __LP64__ 
+    bool hasThreadManager =
+#ifdef __LP64__
         true ; // TODO VERIFY IN NEXT BUILD
 #else
         MPLibraryIsLoaded();
@@ -1216,7 +1209,7 @@ bool wxThreadModule::OnInit()
     verify_noerr( MPAllocateTaskStorageIndex( &gs_tlsForWXThread ) ) ;
     verify_noerr( MPSetTaskStorageValue( gs_tlsForWXThread, 0 ) ) ;
 
-    gs_idMainThread = wxThread::GetCurrentId();
+    wxThread::ms_idMainThread = wxThread::GetCurrentId();
     gs_critsectWaitingForGui = new wxCriticalSection();
 
     gs_critsectGui = new wxCriticalSection();
@@ -1236,12 +1229,10 @@ void wxThreadModule::OnExit()
         }
 
         gs_critsectGui->Leave();
-        delete gs_critsectGui;
-        gs_critsectGui = NULL;
+        wxDELETE(gs_critsectGui);
     }
 
-    delete gs_critsectWaitingForGui;
-    gs_critsectWaitingForGui = NULL;
+    wxDELETE(gs_critsectWaitingForGui);
 }
 
 // ----------------------------------------------------------------------------