summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-12 20:42:50 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-12 20:42:50 +0100
commit57659f010ea62e157d34d227b79d67f8d1b8b96b (patch)
tree3dcfc82eb0b1e087de02808597b3114343927655
parentAdded a flat terrain generator with settable terrain height (diff)
downloadcuberite-57659f010ea62e157d34d227b79d67f8d1b8b96b.tar
cuberite-57659f010ea62e157d34d227b79d67f8d1b8b96b.tar.gz
cuberite-57659f010ea62e157d34d227b79d67f8d1b8b96b.tar.bz2
cuberite-57659f010ea62e157d34d227b79d67f8d1b8b96b.tar.lz
cuberite-57659f010ea62e157d34d227b79d67f8d1b8b96b.tar.xz
cuberite-57659f010ea62e157d34d227b79d67f8d1b8b96b.tar.zst
cuberite-57659f010ea62e157d34d227b79d67f8d1b8b96b.zip
Diffstat (limited to '')
-rw-r--r--source/cEvent.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/cEvent.cpp b/source/cEvent.cpp
index 17d56be91..cc476400f 100644
--- a/source/cEvent.cpp
+++ b/source/cEvent.cpp
@@ -38,6 +38,12 @@ cEvent::cEvent(void)
LOGERROR("cEvent: Cannot create event, errno = %i. Aborting server.", errno);
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);
+ }
}
#endif // *nix
}
@@ -53,10 +59,6 @@ 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);