summaryrefslogtreecommitdiffstats
path: root/source/cEvent.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-12 14:31:34 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-12 14:31:34 +0100
commitb789d5ebf6bba3231cb77839cb48e7c5d9c43930 (patch)
treed69d18c66a6eca85f1f4e29bb5ecd61e4d3f602d /source/cEvent.cpp
parentStopping the ChunkSender upon server stop (diff)
downloadcuberite-b789d5ebf6bba3231cb77839cb48e7c5d9c43930.tar
cuberite-b789d5ebf6bba3231cb77839cb48e7c5d9c43930.tar.gz
cuberite-b789d5ebf6bba3231cb77839cb48e7c5d9c43930.tar.bz2
cuberite-b789d5ebf6bba3231cb77839cb48e7c5d9c43930.tar.lz
cuberite-b789d5ebf6bba3231cb77839cb48e7c5d9c43930.tar.xz
cuberite-b789d5ebf6bba3231cb77839cb48e7c5d9c43930.tar.zst
cuberite-b789d5ebf6bba3231cb77839cb48e7c5d9c43930.zip
Diffstat (limited to '')
-rw-r--r--source/cEvent.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/source/cEvent.cpp b/source/cEvent.cpp
index c52a8a226..17d56be91 100644
--- a/source/cEvent.cpp
+++ b/source/cEvent.cpp
@@ -26,11 +26,7 @@ cEvent::cEvent(void)
m_Event = new sem_t;
if (sem_init(m_Event, 0, 0))
{
- LOGWARN("WARNING cEvent: Could not create unnamed semaphore, fallback to named.");
-
- // _X: I'm unconvinced about using sem_unlink() just after a successful sem_open(), it seems wrong - why destroy the object just after creating?
- ASSERT(!"This codepath is really weird, if it is ever used, please check that everything works.");
-
+ // This path is used by MacOS, because it doesn't support unnamed semaphores.
delete m_Event;
m_bIsNamed = true;
@@ -42,13 +38,6 @@ cEvent::cEvent(void)
LOGERROR("cEvent: Cannot create event, errno = %i. Aborting server.", errno);
abort();
}
- else
- {
- if( sem_unlink(EventName.c_str()) != 0 )
- {
- LOGWARN("ERROR: Could not unlink cEvent. (%i)", errno);
- }
- }
}
#endif // *nix
}
@@ -64,6 +53,10 @@ cEvent::~cEvent()
#else
if (m_bIsNamed)
{
+ if (sem_unlink(EventName.c_str()) != 0)
+ {
+ LOGWARN("ERROR: Could not unlink cEvent. (%i)", errno);
+ }
if (sem_close(m_Event) != 0)
{
LOGERROR("ERROR: Could not close cEvent. (%i)", errno);