[PATCH] D53049: Annotate scoped_lock as with scoped_lockable attribute
Aaron Puchert via Phabricator
reviews at reviews.llvm.org
Tue Oct 9 16:44:42 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL344096: Annotate scoped_lock as with scoped_lockable attribute (authored by aaronpuchert, committed by ).
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
https://reviews.llvm.org/D53049
Files:
libcxx/trunk/include/mutex
libcxx/trunk/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
Index: libcxx/trunk/include/mutex
===================================================================
--- libcxx/trunk/include/mutex
+++ libcxx/trunk/include/mutex
@@ -489,7 +489,7 @@
};
template <class _Mutex>
-class _LIBCPP_TEMPLATE_VIS scoped_lock<_Mutex> {
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) scoped_lock<_Mutex> {
public:
typedef _Mutex mutex_type;
private:
Index: libcxx/trunk/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
===================================================================
--- libcxx/trunk/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
+++ libcxx/trunk/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp
@@ -24,7 +24,13 @@
std::mutex m;
int foo __attribute__((guarded_by(m)));
+static void scoped() {
+ std::scoped_lock<std::mutex> lock(m);
+ foo++;
+}
+
int main() {
+ scoped();
std::lock_guard<std::mutex> lock(m);
foo++;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53049.168907.patch
Type: text/x-patch
Size: 974 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181009/d144d9d4/attachment.bin>
More information about the libcxx-commits
mailing list