34 pthread_mutexattr_t attr;
36 rc = pthread_mutexattr_init(&attr);
39 rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
41 rc = pthread_mutex_init(&fMutex, &attr);
43 SysError(
"TPosixMutex",
"pthread_mutex_init error");
45 SysError(
"TPosixMutex",
"pthread_mutexattr_settype error");
47 SysError(
"TPosixMutex",
"pthread_mutex_init error");
49 pthread_mutexattr_destroy(&attr);
53 int rc = pthread_mutex_init(&fMutex, 0);
55 SysError(
"TPosixMutex",
"pthread_mutex_init error");
65 int rc = pthread_mutex_destroy(&
fMutex);
67 SysError(
"~TPosixMutex",
"pthread_mutex_destroy error");
75 return pthread_mutex_lock(&
fMutex);
83 return pthread_mutex_trylock(&
fMutex);
91 return pthread_mutex_unlock(&
fMutex);
Int_t UnLock()
Unlock the mutex.
virtual void SysError(const char *method, const char *msgfmt,...) const
Issue system error message.
Int_t TryLock()
Try locking the mutex. Returns 0 if mutex can be locked.
void SysError(const char *location, const char *msgfmt,...)
Int_t Lock()
Lock the mutex.
virtual ~TPosixMutex()
TMutex dtor.