Skip to content
Snippets Groups Projects
Commit fd2d2615 authored by Eric Cano's avatar Eric Cano
Browse files

Caught up with master branch.

parents 68b6c046 604a07d9
No related branches found
No related tags found
No related merge requests found
......@@ -138,12 +138,32 @@ void castor::log::Log::checkProgramNameLen(const std::string &programName)
// initMutex
//------------------------------------------------------------------------------
void castor::log::Log::initMutex() throw(castor::exception::Internal) {
const int rc = pthread_mutex_init(&m_mutex, NULL);
pthread_mutexattr_t attr;
int rc = pthread_mutexattr_init(&attr);
if(0 != rc) {
castor::exception::Internal ex;
ex.getMessage() << "Failed to initialize mutex attribute: " << sstrerror(rc);
throw ex;
}
rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
if(0 != rc) {
castor::exception::Internal ex;
ex.getMessage() << "Failed to set mutex type: " << sstrerror(rc);
throw ex;
}
rc = pthread_mutex_init(&m_mutex, NULL);
if(0 != rc) {
castor::exception::Internal ex;
ex.getMessage() << "Failed to initialize m_mutex: " << sstrerror(rc);
throw ex;
}
rc = pthread_mutexattr_destroy(&attr);
if(0 != rc) {
pthread_mutex_destroy(&m_mutex);
castor::exception::Internal ex;
ex.getMessage() << "Failed to destroy mutex attribute: " << sstrerror(rc);
throw ex;
}
}
//------------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment