17constexpr MutexPosixImpl::
18MutexPosixImpl() noexcept {
24INLINE MutexPosixImpl::
26 TAU_PROFILE(
"MutexPosixImpl::~MutexPosixImpl",
" ", TAU_USER);
27 int result = pthread_mutex_destroy(&_lock);
34INLINE
void MutexPosixImpl::
36 TAU_PROFILE(
"void MutexPosixImpl::lock",
" ", TAU_USER);
37 int result = pthread_mutex_lock(&_lock);
44INLINE
bool MutexPosixImpl::
46 TAU_PROFILE(
"bool MutexPosixImpl::try_lock",
" ", TAU_USER);
47 int result = pthread_mutex_trylock(&_lock);
48 assert(result == 0 || result == EBUSY);
55INLINE
void MutexPosixImpl::
57 TAU_PROFILE(
"void MutexPosixImpl::unlock",
" ", TAU_USER);
58 int result = pthread_mutex_unlock(&_lock);
65#ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
66constexpr ReMutexPosixImpl::
67ReMutexPosixImpl() noexcept : _lock(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) {
70INLINE ReMutexPosixImpl::
72 TAU_PROFILE(
"ReMutexPosixImpl::ReMutexPosixImpl",
" ", TAU_USER);
73 pthread_mutexattr_t attr;
74 pthread_mutexattr_init(&attr);
75 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
76 int result = pthread_mutex_init(&_lock, &attr);
77 pthread_mutexattr_destroy(&attr);
85INLINE ReMutexPosixImpl::
87 TAU_PROFILE(
"ReMutexPosixImpl::~ReMutexPosixImpl",
" ", TAU_USER);
88 int result = pthread_mutex_destroy(&_lock);
95INLINE
void ReMutexPosixImpl::
97 TAU_PROFILE(
"void ReMutexPosixImpl::lock",
" ", TAU_USER);
98 int result = pthread_mutex_lock(&_lock);
105INLINE
bool ReMutexPosixImpl::
107 TAU_PROFILE(
"bool ReMutexPosixImpl::try_lock",
" ", TAU_USER);
108 int result = pthread_mutex_trylock(&_lock);
109 assert(result == 0 || result == EBUSY);
110 return (result == 0);
116INLINE
void ReMutexPosixImpl::
118 TAU_PROFILE(
"void ReMutexPosixImpl::unlock",
" ", TAU_USER);
119 int result = pthread_mutex_unlock(&_lock);