24 ClassImp(TPosixMutex);
29 TPosixMutex::TPosixMutex(Bool_t recursive) : TMutexImp()
35 pthread_mutexattr_t attr;
37 rc = pthread_mutexattr_init(&attr);
40 rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
42 rc = pthread_mutex_init(&fMutex, &attr);
44 SysError(
"TPosixMutex",
"pthread_mutex_init error");
46 SysError(
"TPosixMutex",
"pthread_mutexattr_settype error");
48 SysError(
"TPosixMutex",
"pthread_mutex_init error");
50 pthread_mutexattr_destroy(&attr);
54 int rc = pthread_mutex_init(&fMutex, 0);
56 SysError(
"TPosixMutex",
"pthread_mutex_init error");
64 TPosixMutex::~TPosixMutex()
66 int rc = pthread_mutex_destroy(&fMutex);
68 SysError(
"~TPosixMutex",
"pthread_mutex_destroy error");
74 Int_t TPosixMutex::Lock()
76 return pthread_mutex_lock(&fMutex);
82 Int_t TPosixMutex::TryLock()
84 return pthread_mutex_trylock(&fMutex);
90 Int_t TPosixMutex::UnLock(
void)
92 return pthread_mutex_unlock(&fMutex);