[PATCH] D54290: [libcxx] Provide thread annotations for shared_mutex

Petr Hosek via Phabricator reviews at reviews.llvm.org
Fri Nov 9 15:35:12 PST 2018


This revision was automatically updated to reflect the committed changes.
phosek marked an inline comment as done.
Closed by commit rL346567: [libcxx] Provide thread annotations for shared_mutex (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54290?vs=173265&id=173460#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54290

Files:
  libcxx/trunk/include/shared_mutex


Index: libcxx/trunk/include/shared_mutex
===================================================================
--- libcxx/trunk/include/shared_mutex
+++ libcxx/trunk/include/shared_mutex
@@ -144,7 +144,8 @@
 
 _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 @@
     __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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54290.173460.patch
Type: text/x-patch
Size: 1512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181109/cd49943a/attachment.bin>


More information about the libcxx-commits mailing list