1
0

Hopefully fixed pthreads in cEvent (again)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@200 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-01-31 12:09:34 +00:00
parent 8baa234541
commit 154399ccd1
2 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,7 @@ cEvent::cEvent(void)
} }
#else // *nix #else // *nix
m_bIsNamed = false; m_bIsNamed = false;
m_Event = new sem_t;
if (sem_init(m_Event, 0, 0)) if (sem_init(m_Event, 0, 0))
{ {
LOGWARN("WARNING cEvent: Could not create unnamed semaphore, fallback to named."); LOGWARN("WARNING cEvent: Could not create unnamed semaphore, fallback to named.");
@ -30,6 +31,7 @@ cEvent::cEvent(void)
// _X: I'm unconvinced about using sem_unlink() just after a successful sem_open(), it seems wrong - why destroy the object just after creating? // _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."); assert(!"This codepath is really weird, if it is ever used, please check that everything works.");
delete m_Event;
m_bIsNamed = true; m_bIsNamed = true;
char c_Str[64]; char c_Str[64];
@ -70,6 +72,7 @@ cEvent::~cEvent()
else else
{ {
sem_destroy(m_Event); sem_destroy(m_Event);
delete m_Event;
} }
#endif #endif
} }

View File

@ -31,7 +31,6 @@ private:
HANDLE m_Event; HANDLE m_Event;
#else #else
sem_t * m_Event; sem_t * m_Event;
bool m_bIsNamed;
#endif #endif
} ; } ;