diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-22 11:24:28 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-22 11:24:28 +0200 |
commit | 3385ed56b86a7816892e199fdda177ebb3a33966 (patch) | |
tree | e4ebda8e1fc245e9a84c3c4b363c05bbbad3a85f /src/OSSupport/Semaphore.cpp | |
parent | Suggestions (diff) | |
parent | Updated prefabs to current Gallery content. (diff) | |
download | cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.gz cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.bz2 cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.lz cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.xz cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.zst cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.zip |
Diffstat (limited to 'src/OSSupport/Semaphore.cpp')
-rw-r--r-- | src/OSSupport/Semaphore.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/OSSupport/Semaphore.cpp b/src/OSSupport/Semaphore.cpp index d919c4744..c1fc7d9c7 100644 --- a/src/OSSupport/Semaphore.cpp +++ b/src/OSSupport/Semaphore.cpp @@ -5,9 +5,9 @@ -cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /* = 0 */ ) +cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /* = 0 */) #ifndef _WIN32 - : m_bNamed( false ) + : m_bNamed( false) #endif { #ifndef _WIN32 @@ -20,15 +20,15 @@ cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /* m_bNamed = true; AString Name; - Printf(Name, "cSemaphore%p", this ); + Printf(Name, "cSemaphore%p", this); m_Handle = sem_open(Name.c_str(), O_CREAT, 777, a_InitialCount); - if( m_Handle == SEM_FAILED ) + if (m_Handle == SEM_FAILED) { - LOG("ERROR: Could not create Semaphore. (%i)", errno ); + LOG("ERROR: Could not create Semaphore. (%i)", errno); } else { - if( sem_unlink(Name.c_str()) != 0 ) + if (sem_unlink(Name.c_str()) != 0) { LOG("ERROR: Could not unlink cSemaphore. (%i)", errno); } @@ -51,18 +51,18 @@ cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /* cSemaphore::~cSemaphore() { #ifdef _WIN32 - CloseHandle( m_Handle ); + CloseHandle( m_Handle); #else - if( m_bNamed ) + if (m_bNamed) { - if( sem_close( (sem_t*)m_Handle ) != 0 ) + if (sem_close( (sem_t*)m_Handle) != 0) { LOG("ERROR: Could not close cSemaphore. (%i)", errno); } } else { - sem_destroy( (sem_t*)m_Handle ); + sem_destroy( (sem_t*)m_Handle); delete (sem_t*)m_Handle; } m_Handle = 0; @@ -77,7 +77,7 @@ cSemaphore::~cSemaphore() void cSemaphore::Wait() { #ifndef _WIN32 - if( sem_wait( (sem_t*)m_Handle ) != 0) + if (sem_wait( (sem_t*)m_Handle) != 0) { LOG("ERROR: Could not wait for cSemaphore. (%i)", errno); } @@ -93,12 +93,12 @@ void cSemaphore::Wait() void cSemaphore::Signal() { #ifndef _WIN32 - if( sem_post( (sem_t*)m_Handle ) != 0 ) + if (sem_post( (sem_t*)m_Handle) != 0) { LOG("ERROR: Could not signal cSemaphore. (%i)", errno); } #else - ReleaseSemaphore( m_Handle, 1, NULL ); + ReleaseSemaphore( m_Handle, 1, NULL); #endif } |