summaryrefslogtreecommitdiffstats
path: root/src/OSSupport
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-20 23:10:31 +0200
committermadmaxoft <github@xoft.cz>2014-07-21 17:38:50 +0200
commit6be79575fd50e37ac275bd0cb9d16f9e51e8a225 (patch)
treeb02e68b73bf1152f9d84020ee006d5325e096691 /src/OSSupport
parentCuboid: added explicit copy assignment operator (diff)
downloadcuberite-6be79575fd50e37ac275bd0cb9d16f9e51e8a225.tar
cuberite-6be79575fd50e37ac275bd0cb9d16f9e51e8a225.tar.gz
cuberite-6be79575fd50e37ac275bd0cb9d16f9e51e8a225.tar.bz2
cuberite-6be79575fd50e37ac275bd0cb9d16f9e51e8a225.tar.lz
cuberite-6be79575fd50e37ac275bd0cb9d16f9e51e8a225.tar.xz
cuberite-6be79575fd50e37ac275bd0cb9d16f9e51e8a225.tar.zst
cuberite-6be79575fd50e37ac275bd0cb9d16f9e51e8a225.zip
Diffstat (limited to 'src/OSSupport')
-rw-r--r--src/OSSupport/Errors.cpp4
-rw-r--r--src/OSSupport/Semaphore.cpp12
-rw-r--r--src/OSSupport/Thread.cpp10
3 files changed, 13 insertions, 13 deletions
diff --git a/src/OSSupport/Errors.cpp b/src/OSSupport/Errors.cpp
index 6072b6ac6..02de28e4e 100644
--- a/src/OSSupport/Errors.cpp
+++ b/src/OSSupport/Errors.cpp
@@ -25,7 +25,7 @@ AString GetOSErrorString( int a_ErrNo )
#if !defined(__APPLE__) && ( _GNU_SOURCE ) && !defined(ANDROID_NDK) // GNU version of strerror_r()
char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
- if( res != NULL )
+ if (res != NULL )
{
Printf(Out, "%d: %s", a_ErrNo, res);
return Out;
@@ -34,7 +34,7 @@ AString GetOSErrorString( int a_ErrNo )
#else // XSI version of strerror_r():
int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
- if( res == 0 )
+ if (res == 0 )
{
Printf(Out, "%d: %s", a_ErrNo, buffer);
return Out;
diff --git a/src/OSSupport/Semaphore.cpp b/src/OSSupport/Semaphore.cpp
index d919c4744..cb9ccc83b 100644
--- a/src/OSSupport/Semaphore.cpp
+++ b/src/OSSupport/Semaphore.cpp
@@ -22,13 +22,13 @@ cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /*
AString Name;
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 );
}
else
{
- if( sem_unlink(Name.c_str()) != 0 )
+ if (sem_unlink(Name.c_str()) != 0 )
{
LOG("ERROR: Could not unlink cSemaphore. (%i)", errno);
}
@@ -53,9 +53,9 @@ cSemaphore::~cSemaphore()
#ifdef _WIN32
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);
}
@@ -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,7 +93,7 @@ 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);
}
diff --git a/src/OSSupport/Thread.cpp b/src/OSSupport/Thread.cpp
index 163c9b0c9..811e7cb21 100644
--- a/src/OSSupport/Thread.cpp
+++ b/src/OSSupport/Thread.cpp
@@ -53,7 +53,7 @@ cThread::cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_Thre
, m_Event( new cEvent() )
, m_StopEvent( 0 )
{
- if( a_ThreadName )
+ if (a_ThreadName )
{
m_ThreadName.assign(a_ThreadName);
}
@@ -68,7 +68,7 @@ cThread::~cThread()
delete m_Event;
m_Event = NULL;
- if( m_StopEvent )
+ if (m_StopEvent )
{
m_StopEvent->Wait();
delete m_StopEvent;
@@ -82,12 +82,12 @@ cThread::~cThread()
void cThread::Start( bool a_bWaitOnDelete /* = true */ )
{
- if( a_bWaitOnDelete )
+ if (a_bWaitOnDelete )
m_StopEvent = new cEvent();
#ifndef _WIN32
pthread_t SndThread;
- if( pthread_create( &SndThread, NULL, MyThread, this) )
+ if (pthread_create( &SndThread, NULL, MyThread, this) )
LOGERROR("ERROR: Could not create thread!");
#else
DWORD ThreadID = 0;
@@ -132,6 +132,6 @@ void *cThread::MyThread( void *a_Param )
ThreadFunction( ThreadParam );
- if( StopEvent ) StopEvent->Set();
+ if (StopEvent ) StopEvent->Set();
return 0;
}