summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-19 10:51:18 +0200
committermadmaxoft <github@xoft.cz>2013-08-19 10:51:18 +0200
commit539ae204665ec2e265e1639ad4dde69941a14f0c (patch)
tree5a9601a1296ad8e470716eca065b67160e95f0f0 /source
parentFinished renaming cPlugin_NewLua to cPluginLua. (diff)
downloadcuberite-539ae204665ec2e265e1639ad4dde69941a14f0c.tar
cuberite-539ae204665ec2e265e1639ad4dde69941a14f0c.tar.gz
cuberite-539ae204665ec2e265e1639ad4dde69941a14f0c.tar.bz2
cuberite-539ae204665ec2e265e1639ad4dde69941a14f0c.tar.lz
cuberite-539ae204665ec2e265e1639ad4dde69941a14f0c.tar.xz
cuberite-539ae204665ec2e265e1639ad4dde69941a14f0c.tar.zst
cuberite-539ae204665ec2e265e1639ad4dde69941a14f0c.zip
Diffstat (limited to 'source')
-rw-r--r--source/OSSupport/Event.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/source/OSSupport/Event.cpp b/source/OSSupport/Event.cpp
index f3c9053b1..9348384b0 100644
--- a/source/OSSupport/Event.cpp
+++ b/source/OSSupport/Event.cpp
@@ -144,24 +144,19 @@ cEvent::eWaitResult cEvent::Wait(int a_TimeoutMilliSec)
timeout.tv_sec = a_TimeoutMilliSec / 1000;
timeout.tv_nsec = (a_TimeoutMilliSec % 1000) * 1000000;
int res = sem_timedwait(m_Event, &timeout);
- switch (res)
+ if (res == 0)
{
- case 0:
- {
- // The semaphore was signalled
- return wrSignalled;
- }
- case ETIMEDOUT:
- {
- // The timeout was hit
- return wrTimeout;
- }
- default:
- {
- LOGWARNING("cEvent: timed-waiting for the event failed: %i, errno = %i. Continuing, but server may be unstable.", res, errno);
- return wrError;
- }
+ // The semaphore was signalled
+ return wrSignalled;
+ }
+ int err = errno;
+ if (err == ETIMEDOUT)
+ {
+ // The timeout was hit
+ return wrTimeout;
}
+ LOGWARNING("cEvent: timed-waiting for the event failed: %i, errno = %i. Continuing, but server may be unstable.", res, err);
+ return wrError;
#endif
}