Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Clang TSA annotations to recursive_mutex #347

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions include/boost/thread/pthread/recursive_mutex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

namespace boost
{
class recursive_mutex
class BOOST_THREAD_CAPABILITY("mutex") recursive_mutex
{
private:
pthread_mutex_t m;
Expand Down Expand Up @@ -103,17 +103,17 @@ namespace boost
}

#ifdef BOOST_THREAD_HAS_PTHREAD_MUTEXATTR_SETTYPE
void lock()
void lock() BOOST_THREAD_ACQUIRE()
{
BOOST_VERIFY(!posix::pthread_mutex_lock(&m));
}

void unlock()
void unlock() BOOST_THREAD_RELEASE()
{
BOOST_VERIFY(!posix::pthread_mutex_unlock(&m));
}

bool try_lock() BOOST_NOEXCEPT
bool try_lock() BOOST_NOEXCEPT BOOST_THREAD_TRY_ACQUIRE(true)
{
int const res=posix::pthread_mutex_trylock(&m);
BOOST_ASSERT(!res || res==EBUSY);
Expand All @@ -127,7 +127,7 @@ namespace boost
}

#else
void lock()
void lock() BOOST_THREAD_ACQUIRE()
{
boost::pthread::pthread_mutex_scoped_lock const local_lock(&m);
if(is_locked && pthread_equal(owner,pthread_self()))
Expand All @@ -145,7 +145,7 @@ namespace boost
owner=pthread_self();
}

void unlock()
void unlock() BOOST_THREAD_RELEASE()
{
boost::pthread::pthread_mutex_scoped_lock const local_lock(&m);
if(!--count)
Expand All @@ -155,7 +155,7 @@ namespace boost
BOOST_VERIFY(!posix::pthread_cond_signal(&cond));
}

bool try_lock()
bool try_lock() BOOST_THREAD_TRY_ACQUIRE(true)
{
boost::pthread::pthread_mutex_scoped_lock const local_lock(&m);
if(is_locked && !pthread_equal(owner,pthread_self()))
Expand Down