00001 // Copyright CERN 2012 - Developed in collaboration with GSI 00002 00003 #include <fesa-core/Utilities/Mutex.h> 00004 00005 #include <fesa-core/Exception/FesaException.h> 00006 00007 00008 namespace fesa 00009 { 00010 00011 Mutex::Mutex(): AbstractMutex() 00012 { 00013 lock_ = new pthread_mutex_t(); 00014 memoryOwner_= true; 00015 init(PTHREAD_PROCESS_PRIVATE); 00016 } 00017 00018 Mutex::Mutex(void* pAdrMemory) : AbstractMutex() 00019 { 00020 lock_ = (pthread_mutex_t*) pAdrMemory; 00021 if (!lock_) 00022 { 00023 throw FesaException(__FILE__, __LINE__, FesaErrorCreatingMutex.c_str(), " (mapping it to memory block)"); 00024 } 00025 memoryOwner_= false; 00026 init(PTHREAD_PROCESS_PRIVATE); 00027 } 00028 00029 } // fesa