diff options
| author | Petr Hosek <phosek@chromium.org> | 2018-11-09 23:32:25 +0000 |
|---|---|---|
| committer | Petr Hosek <phosek@chromium.org> | 2018-11-09 23:32:25 +0000 |
| commit | f30c0117c890fcb8265c556c0a02ab89542473a2 (patch) | |
| tree | d59cec93a42089fd42f59b16b32dd98457d5d9dc /libcxx/include | |
| parent | e2d56dcc038b4202ef36db1f423fb8ba894a0469 (diff) | |
| download | bcm5719-llvm-f30c0117c890fcb8265c556c0a02ab89542473a2.tar.gz bcm5719-llvm-f30c0117c890fcb8265c556c0a02ab89542473a2.zip | |
[libcxx] Provide thread annotations for shared_mutex
shared_mutex was introduced in C++17 but its implementation currently
doesn't use Clang's thread annotations like regular mutex. This change
adds those.
Differential Revision: https://reviews.llvm.org/D54290
llvm-svn: 346567
Diffstat (limited to 'libcxx/include')
| -rw-r--r-- | libcxx/include/shared_mutex | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex index fbde0cf137a..3daf74d26c7 100644 --- a/libcxx/include/shared_mutex +++ b/libcxx/include/shared_mutex @@ -144,7 +144,8 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD -struct _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX __shared_mutex_base +struct _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("shared_mutex")) +__shared_mutex_base { mutex __mut_; condition_variable __gate1_; @@ -161,14 +162,14 @@ struct _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX __shared_mutex_base __shared_mutex_base& operator=(const __shared_mutex_base&) = delete; // Exclusive ownership - void lock(); // blocking - bool try_lock(); - void unlock(); + void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability()); // blocking + bool try_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true)); + void unlock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()); // Shared ownership - void lock_shared(); // blocking - bool try_lock_shared(); - void unlock_shared(); + void lock_shared() _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_shared_capability()); // blocking + bool try_lock_shared() _LIBCPP_THREAD_SAFETY_ANNOTATION(try_acquire_shared_capability(true)); + void unlock_shared() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_shared_capability()); // typedef implementation-defined native_handle_type; // See 30.2.3 // native_handle_type native_handle(); // See 30.2.3 |

