};
wxSemaphoreInternal::wxSemaphoreInternal( int initialcount, int maxcount )
- : m_cond(m_mutex)
+ : m_cond(&m_mutex)
{
if ( (initialcount < 0) || ((maxcount > 0) && (initialcount > maxcount)) )
void wxSemaphoreInternal::Wait()
{
- wxMutexLocker locker(*m_mutex);
+ wxMutexLocker locker(m_mutex);
while ( count <= 0 )
{
- m_cond->Wait();
+ m_cond.Wait();
}
count--;
bool wxSemaphoreInternal::TryWait()
{
- wxMutexLocker locker(*m_mutex);
+ wxMutexLocker locker(m_mutex);
if ( count <= 0 )
return FALSE;
bool wxSemaphoreInternal::Wait( unsigned long timeout_millis )
{
- wxMutexLocker locker( *m_mutex );
+ wxMutexLocker locker(m_mutex);
wxLongLong startTime = wxGetLocalTimeMillis();
if ( remainingTime <= 0 )
return FALSE;
- bool result = m_cond->Wait( remainingTime );
+ bool result = m_cond.Wait( remainingTime );
if ( !result )
return FALSE;
}
void wxSemaphoreInternal::Post()
{
- wxMutexLocker locker(*m_mutex);
+ wxMutexLocker locker(m_mutex);
- if ( (maxcount > 0) && (count == maxcount) )
+ if ( maxcount > 0 && count == maxcount )
{
wxFAIL_MSG( _T("wxSemaphore::Post() overflow") );
}
count++;
- m_cond->Signal();
+ m_cond.Signal();
}
// --------------------------------------------------------------------------