No thread-safe annotations for mutex and related classes
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
The clang compiler comes with some very useful warnings under the umbrella of -Wthread-safety. (See https://clang.llvm.org/docs/ThreadSafetyAnalysis.html) Unfortunately, the MS STL does not provide annotations to the relevant classes, such that this warning cannot be used with the standard STL types.
How about other implementations?
- libc++ adds these annotations (https://github.com/llvm-mirror/libcxx/blob/master/include/mutex)
- libstdc++ does not add these annotations (https://gcc.gnu.org/onlinedocs/gcc-12.1.0/libstdc++/api/a00143_source.html#l00692)
Would it be possible to decorate the thread safety analysis such that this warning can be used and prevent a lot of debugging time for threading issues that are easily caught by the compiler?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked libc++ mutex annotations and the libstdc++ mutex source, then inspect the corresponding MS STL mutex and related class headers. Determine which standard-library types need annotations and verify that Clang's -Wthread-safety can use them without breaking supported configurations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100