21 INLINE MutexPosixImpl::
23 TAU_PROFILE(
"MutexPosixImpl::MutexPosixImpl",
" ", TAU_USER);
24 pthread_mutexattr_t attr;
25 pthread_mutexattr_init(&attr);
28 int result = pthread_mutex_init(&_lock, &attr);
29 pthread_mutexattr_destroy(&attr);
38 INLINE MutexPosixImpl::
40 TAU_PROFILE(
"MutexPosixImpl::~MutexPosixImpl",
" ", TAU_USER);
41 int result = pthread_mutex_destroy(&_lock);
50 INLINE
void MutexPosixImpl::
52 TAU_PROFILE(
"void MutexPosixImpl::acquire",
" ", TAU_USER);
53 int result = pthread_mutex_lock(&_lock);
62 INLINE
bool MutexPosixImpl::
64 TAU_PROFILE(
"bool MutexPosixImpl::try_acquire",
" ", TAU_USER);
65 int result = pthread_mutex_trylock(&_lock);
66 assert(result == 0 || result == EBUSY);
75 INLINE
void MutexPosixImpl::
77 TAU_PROFILE(
"void MutexPosixImpl::release",
" ", TAU_USER);
78 int result = pthread_mutex_unlock(&_lock);
87 INLINE pthread_mutex_t *MutexPosixImpl::
97 INLINE ReMutexPosixImpl::
99 TAU_PROFILE(
"ReMutexPosixImpl::ReMutexPosixImpl",
" ", TAU_USER);
100 pthread_mutexattr_t attr;
101 pthread_mutexattr_init(&attr);
102 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
103 int result = pthread_mutex_init(&_lock, &attr);
104 pthread_mutexattr_destroy(&attr);
113 INLINE ReMutexPosixImpl::
114 ~ReMutexPosixImpl() {
115 TAU_PROFILE(
"ReMutexPosixImpl::~ReMutexPosixImpl",
" ", TAU_USER);
116 int result = pthread_mutex_destroy(&_lock);
125 INLINE
void ReMutexPosixImpl::
127 TAU_PROFILE(
"void ReMutexPosixImpl::acquire",
" ", TAU_USER);
128 int result = pthread_mutex_lock(&_lock);
137 INLINE
bool ReMutexPosixImpl::
139 TAU_PROFILE(
"bool ReMutexPosixImpl::try_acquire",
" ", TAU_USER);
140 int result = pthread_mutex_trylock(&_lock);
141 assert(result == 0 || result == EBUSY);
142 return (result == 0);
150 INLINE
void ReMutexPosixImpl::
152 TAU_PROFILE(
"void ReMutexPosixImpl::release",
" ", TAU_USER);
153 int result = pthread_mutex_unlock(&_lock);
162 INLINE pthread_mutex_t *ReMutexPosixImpl::