/////////////////////////////////////////////////////////////////////////////
-// Name: src/mac/carbon/thread.cpp
+// Name: src/osx/carbon/thread.cpp
// Purpose: wxThread Implementation
// Author: Original from Wolfram Gloger/Guilhem Lavaux/Vadim Zeitlin
// Modified by: Aj Lavin, Stefan Csomor
// ----------------------------------------------------------------------------
// 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;
// wxCriticalSection
// ----------------------------------------------------------------------------
-wxCriticalSection::wxCriticalSection()
+wxCriticalSection::wxCriticalSection( wxCriticalSectionType WXUNUSED(critSecType) )
{
MPCreateCriticalRegion( (MPCriticalRegionID*) &m_critRegion );
}
wxMutex& m_mutex;
wxSemaphore m_semaphore;
- DECLARE_NO_COPY_CLASS(wxConditionInternal)
+ wxDECLARE_NO_COPY_CLASS(wxConditionInternal);
};
wxConditionInternal::wxConditionInternal( wxMutex& mutex )
return thr;
}
-bool wxThread::IsMain()
-{
- return GetCurrentId() == gs_idMainThread || gs_idMainThread == kInvalidID ;
-}
-
#ifdef Yield
#undef Yield
#endif
g_numberOfThreads--;
-#ifdef __WXDEBUG__
m_critsect.Enter();
// check that the thread either exited or couldn't be created
}
m_critsect.Leave();
-#endif
wxDELETE( m_internal ) ;
}
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);
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();
}
bool wxThreadModule::OnInit()
{
- bool hasThreadManager =
-#ifdef __LP64__
+ bool hasThreadManager =
+#ifdef __LP64__
true ; // TODO VERIFY IN NEXT BUILD
#else
MPLibraryIsLoaded();
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();
}
gs_critsectGui->Leave();
- delete gs_critsectGui;
- gs_critsectGui = NULL;
+ wxDELETE(gs_critsectGui);
}
- delete gs_critsectWaitingForGui;
- gs_critsectWaitingForGui = NULL;
+ wxDELETE(gs_critsectWaitingForGui);
}
// ----------------------------------------------------------------------------