[libcxx-dev] std::unique_lock with thread annotations
Pooyan McSporran via libcxx-dev
libcxx-dev at lists.llvm.org
Fri Oct 11 18:50:48 PDT 2019
I've been experimenting with -Wthread-safety in clang/libc++. The
documentation at https://libcxx.llvm.org/docs/UsingLibcxx.html says that
_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS is 'used to enable -Wthread-safety
annotations on libc++’s std::mutex and std::lock_guard'.
I'm hoping to use thread-safety analysis for a sizeable code base which
makes a lot of use of unique_lock, but there's no libc++ annotations for
unique_lock, just for lock_guard. What is the status of this? Is this
something that might be addressed in the future, or is it fundamentally
problematic? I gather it's complicated by the optional deferred locking
For my purposes I can work around the issue by changing uses of unique_lock
to instead be lock_guard (which needs to be done anyway) so it's not a
show-stopper for me, just curious.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libcxx-dev