summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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);