summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/Event.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-01-25 19:43:00 +0100
committerMattes D <github@xoft.cz>2014-01-25 19:43:00 +0100
commitc8be9b5b1aa152e61ca61870c0f95313571e1918 (patch)
tree93be710bd8884e526ff719b4302fd2eb4569b66c /src/OSSupport/Event.cpp
parentComm logging is available in both Debug and Release modes. (diff)
parentSwitched cEvent to GetOSErrorString (diff)
downloadcuberite-c8be9b5b1aa152e61ca61870c0f95313571e1918.tar
cuberite-c8be9b5b1aa152e61ca61870c0f95313571e1918.tar.gz
cuberite-c8be9b5b1aa152e61ca61870c0f95313571e1918.tar.bz2
cuberite-c8be9b5b1aa152e61ca61870c0f95313571e1918.tar.lz
cuberite-c8be9b5b1aa152e61ca61870c0f95313571e1918.tar.xz
cuberite-c8be9b5b1aa152e61ca61870c0f95313571e1918.tar.zst
cuberite-c8be9b5b1aa152e61ca61870c0f95313571e1918.zip
Diffstat (limited to 'src/OSSupport/Event.cpp')
-rw-r--r--src/OSSupport/Event.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/OSSupport/Event.cpp b/src/OSSupport/Event.cpp
index cbacbba17..649a0a3cf 100644
--- a/src/OSSupport/Event.cpp
+++ b/src/OSSupport/Event.cpp
@@ -7,7 +7,7 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Event.h"
-
+#include "Errors.h"
@@ -35,14 +35,16 @@ cEvent::cEvent(void)
m_Event = sem_open(EventName.c_str(), O_CREAT, 777, 0 );
if (m_Event == SEM_FAILED)
{
- LOGERROR("cEvent: Cannot create event, errno = %i. Aborting server.", errno);
+ AString error = GetOSErrorString(errno);
+ LOGERROR("cEvent: Cannot create event, err = %s. Aborting server.", error.c_str());
abort();
}
// Unlink the semaphore immediately - it will continue to function but will not pollute the namespace
// We don't store the name, so can't call this in the destructor
if (sem_unlink(EventName.c_str()) != 0)
{
- LOGWARN("ERROR: Could not unlink cEvent. (%i)", errno);
+ AString error = GetOSErrorString(errno);
+ LOGWARN("ERROR: Could not unlink cEvent. (%s)", error.c_str());
}
}
#endif // *nix
@@ -61,7 +63,8 @@ cEvent::~cEvent()
{
if (sem_close(m_Event) != 0)
{
- LOGERROR("ERROR: Could not close cEvent. (%i)", errno);
+ AString error = GetOSErrorString(errno);
+ LOGERROR("ERROR: Could not close cEvent. (%s)", error.c_str());
}
}
else
@@ -88,7 +91,8 @@ void cEvent::Wait(void)
int res = sem_wait(m_Event);
if (res != 0 )
{
- LOGWARN("cEvent: waiting for the event failed: %i, errno = %i. Continuing, but server may be unstable.", res, errno);
+ AString error = GetOSErrorString(errno);
+ LOGWARN("cEvent: waiting for the event failed: %i, err = %s. Continuing, but server may be unstable.", res, error.c_str());
}
#endif
}
@@ -108,7 +112,8 @@ void cEvent::Set(void)
int res = sem_post(m_Event);
if (res != 0)
{
- LOGWARN("cEvent: Could not set cEvent: %i, errno = %d", res, errno);
+ AString error = GetOSErrorString(errno);
+ LOGWARN("cEvent: Could not set cEvent: %i, err = %s", res, error.c_str());
}
#endif
}