summaryrefslogtreecommitdiff
path: root/src/threadengines/threadengine_pthread.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-22 15:33:41 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-22 15:33:41 +0000
commited1902f23cd79f45c5795893ac67f383952ac407 (patch)
treee5d43575d5d5b50b5c83a6d93e914cd3dc2441d1 /src/threadengines/threadengine_pthread.cpp
parent5942eeb7edad7f01b3ab80378ab95ee5894f6bbf (diff)
Add mutex wrappers
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8996 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/threadengines/threadengine_pthread.cpp')
-rw-r--r--src/threadengines/threadengine_pthread.cpp5
1 files changed, 5 insertions, 0 deletions
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()