From ed1902f23cd79f45c5795893ac67f383952ac407 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 22 Feb 2008 15:33:41 +0000 Subject: Add mutex wrappers git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8996 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/threadengines/threadengine_pthread.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp index 94365bd30..d6b0f3bd7 100644 --- a/src/threadengines/threadengine_pthread.cpp +++ b/src/threadengines/threadengine_pthread.cpp @@ -28,9 +28,12 @@ void PThreadEngine::Create(Thread* thread_to_init) pthread_attr_setdetachstate(&attribs, PTHREAD_CREATE_JOINABLE); pthread_t* MyPThread = new pthread_t; + Mutex(true); + if (pthread_create(MyPThread, &attribs, PThreadEngine::Entry, (void*)this) != 0) { delete MyPThread; + Mutex(false); throw CoreException("Unable to create new PThreadEngine: " + std::string(strerror(errno))); } @@ -39,6 +42,8 @@ void PThreadEngine::Create(Thread* thread_to_init) NewThread = thread_to_init; NewThread->Creator = this; NewThread->Extend("pthread", MyPThread); + + Mutex(false); } PThreadEngine::~PThreadEngine() -- cgit v1.2.3