X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fpthreadwrapper%2Fmutex.cpp;fp=src%2Fpthreadwrapper%2Fmutex.cpp;h=0000000000000000000000000000000000000000;hb=dec33c63afafabf83c3039e916725cac6faef9b3;hp=aec65610e239589e2395c2b6bdeae984890f9384;hpb=9b22dd53fe62e312c1647310b7ec43aa127090af;p=fms.git diff --git a/src/pthreadwrapper/mutex.cpp b/src/pthreadwrapper/mutex.cpp deleted file mode 100644 index aec6561..0000000 --- a/src/pthreadwrapper/mutex.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include "../../include/pthreadwrapper/mutex.h" -#include - -#ifndef _WIN32 - #include -#endif - -#ifdef XMEM - #include -#endif - -namespace PThread -{ - -Mutex::Mutex() -{ - pthread_mutexattr_init(&m_attr); - pthread_mutexattr_settype(&m_attr,PTHREAD_MUTEX_ERRORCHECK); - pthread_mutex_init(&m_mutex,&m_attr); -} - -Mutex::~Mutex() -{ - pthread_mutex_destroy(&m_mutex); - pthread_mutexattr_destroy(&m_attr); -} - -void Mutex::Acquire() throw(std::exception) -{ - int rval=0; - if((rval=pthread_mutex_lock(&m_mutex))!=0) - { - // deadlock - throw exception - if(rval==EDEADLK) - { - throw DeadlockException(); - } - } -} - -void Mutex::Release() -{ - pthread_mutex_unlock(&m_mutex); -} - -} // namespace