This change moves the thread annotations from __shared_mutex_base
to shared_mutex and introduces tests to ensure their functionality.
Details
Diff Detail
- Repository
- rCXX libc++
Event Timeline
When are those annotations enabled? By default they're turned off, would it make sense to turn them on by default? It seems like we're missing out on something interesting here.
It would be nice to have a test (in test/libcxx) to check that these annotations are in the expected places.
Is there still interest in doing this? If so, I actually think we should test those annotations, perhaps by enabling them in some CI configuration (TSAN?). How can we do that? Will request changes so it shows up in the queue properly.
These are statically checked by the compiler when _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS is defined. I've included tests to cover the newly added annotations similarly to how we already test annotations on std::mutex.
libcxx/test/libcxx/thread/thread.shared_mutex/thread_safety_missing_unlock.fail.cpp | ||
---|---|---|
1 ↗ | (On Diff #363556) | Can we make this a .verify.cpp instead? |
libcxx/test/libcxx/thread/thread.shared_mutex/thread_safety_missing_unlock_shared.fail.cpp | ||
1 ↗ | (On Diff #363556) | .verify.cpp |
libcxx/test/libcxx/thread/thread.shared_mutex/thread_safety_requires_capability.fail.cpp | ||
1 ↗ | (On Diff #363556) | .verify.cpp |
38–46 ↗ | (On Diff #363556) | Is this actually required to trigger the error? If not, let's not have a main function at all. If so, I don't understand how this works! |