Fixed tabs used for alignment.
This commit is contained in:
@@ -44,48 +44,64 @@ cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /*
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cSemaphore::~cSemaphore()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
CloseHandle( m_Handle );
|
||||
#else
|
||||
if( m_bNamed )
|
||||
{
|
||||
if( sem_close( (sem_t*)m_Handle ) != 0 )
|
||||
{
|
||||
LOG("ERROR: Could not close cSemaphore. (%i)", errno);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sem_destroy( (sem_t*)m_Handle );
|
||||
delete (sem_t*)m_Handle;
|
||||
}
|
||||
if( m_bNamed )
|
||||
{
|
||||
if( sem_close( (sem_t*)m_Handle ) != 0 )
|
||||
{
|
||||
LOG("ERROR: Could not close cSemaphore. (%i)", errno);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sem_destroy( (sem_t*)m_Handle );
|
||||
delete (sem_t*)m_Handle;
|
||||
}
|
||||
m_Handle = 0;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cSemaphore::Wait()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
if( sem_wait( (sem_t*)m_Handle ) != 0)
|
||||
{
|
||||
LOG("ERROR: Could not wait for cSemaphore. (%i)", errno);
|
||||
}
|
||||
if( sem_wait( (sem_t*)m_Handle ) != 0)
|
||||
{
|
||||
LOG("ERROR: Could not wait for cSemaphore. (%i)", errno);
|
||||
}
|
||||
#else
|
||||
WaitForSingleObject( m_Handle, INFINITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cSemaphore::Signal()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
if( sem_post( (sem_t*)m_Handle ) != 0 )
|
||||
{
|
||||
LOG("ERROR: Could not signal cSemaphore. (%i)", errno);
|
||||
LOG("ERROR: Could not signal cSemaphore. (%i)", errno);
|
||||
}
|
||||
#else
|
||||
ReleaseSemaphore( m_Handle, 1, NULL );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user