X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea736fec49caf6e9fbacf59c7fecd93d73b767ce..4ac219f63d40983d417cabc09b2ed29c0f87c376:/src/mac/carbon/thread.cpp diff --git a/src/mac/carbon/thread.cpp b/src/mac/carbon/thread.cpp index 69a6e85003..75db6e539e 100644 --- a/src/mac/carbon/thread.cpp +++ b/src/mac/carbon/thread.cpp @@ -35,9 +35,7 @@ #include "wx/thread.h" #ifdef __WXMAC__ -#ifndef __DARWIN__ #include -#endif #include "wx/mac/uma.h" #endif @@ -148,7 +146,6 @@ wxMutexError wxMutex::TryLock() wxMacStCritical critical ; if ( UMASystemIsInitialized() ) { - OSErr err ; ThreadID current = kNoThreadID; ::MacGetCurrentThread(¤t); // if we are not the owner, give an error back @@ -207,7 +204,7 @@ wxMutexError wxMutex::Unlock() class wxConditionInternal { public: - wxConditionInternal() + wxConditionInternal(wxMutex& mutex) : m_mutex(mutex) { m_excessSignals = 0 ; } @@ -249,11 +246,12 @@ public: wxArrayLong m_waiters ; wxInt32 m_excessSignals ; + wxMutex& m_mutex; }; -wxCondition::wxCondition() +wxCondition::wxCondition(wxMutex& mutex) { - m_internal = new wxConditionInternal; + m_internal = new wxConditionInternal(mutex); } wxCondition::~wxCondition() @@ -266,10 +264,9 @@ void wxCondition::Wait() (void)m_internal->Wait(0xFFFFFFFFL); } -bool wxCondition::Wait(unsigned long sec, - unsigned long nsec) +bool wxCondition::Wait(unsigned long timeout_millis) { - return m_internal->Wait(sec*1000 + nsec/1000000); + return m_internal->Wait(timeout_millis); } void wxCondition::Signal() @@ -287,7 +284,7 @@ void wxCondition::Broadcast() // 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 ( int i = 0; i < m_internal->m_waiters.Count(); i++ ) + for ( size_t i = 0; i < m_internal->m_waiters.Count(); i++ ) { Signal(); } @@ -479,7 +476,7 @@ wxThread *wxThread::This() err = MacGetCurrentThread( ¤t ) ; - for ( int i = 0 ; i < s_threads.Count() ; ++i ) + for ( size_t i = 0 ; i < s_threads.Count() ; ++i ) { if ( ( (wxThread*) s_threads[i] )->GetId() == current ) return (wxThread*) s_threads[i] ;