17 constexpr MutexPosixImpl::
18 MutexPosixImpl() noexcept : _lock(PTHREAD_MUTEX_INITIALIZER) {
24 INLINE MutexPosixImpl::
26 TAU_PROFILE(
"MutexPosixImpl::~MutexPosixImpl",
" ", TAU_USER);
27 int result = pthread_mutex_destroy(&_lock);
34 INLINE
void MutexPosixImpl::
36 TAU_PROFILE(
"void MutexPosixImpl::lock",
" ", TAU_USER);
37 int result = pthread_mutex_lock(&_lock);
44 INLINE
bool MutexPosixImpl::
46 TAU_PROFILE(
"bool MutexPosixImpl::try_lock",
" ", TAU_USER);
47 int result = pthread_mutex_trylock(&_lock);
48 assert(result == 0 || result == EBUSY);
55 INLINE
void MutexPosixImpl::
57 TAU_PROFILE(
"void MutexPosixImpl::unlock",
" ", TAU_USER);
58 int result = pthread_mutex_unlock(&_lock);
65 #ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 66 constexpr ReMutexPosixImpl::
67 ReMutexPosixImpl() noexcept : _lock(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) {
70 INLINE 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);
85 INLINE ReMutexPosixImpl::
87 TAU_PROFILE(
"ReMutexPosixImpl::~ReMutexPosixImpl",
" ", TAU_USER);
88 int result = pthread_mutex_destroy(&_lock);
95 INLINE
void ReMutexPosixImpl::
97 TAU_PROFILE(
"void ReMutexPosixImpl::lock",
" ", TAU_USER);
98 int result = pthread_mutex_lock(&_lock);
105 INLINE
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);
116 INLINE
void ReMutexPosixImpl::
118 TAU_PROFILE(
"void ReMutexPosixImpl::unlock",
" ", TAU_USER);
119 int result = pthread_mutex_unlock(&_lock);