<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/154281>154281</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Thread safety doesn't allow annotating multiple standard library features
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
philnik777
</td>
</tr>
</table>
<pre>
The current thread safety annotation attributes don't cover the full standard library surface, which is quite unfortunate. Currently the following features don't have any annotations in libc++:
- `recursive_mutex`
- `timed_mutex`
- `recursive_timed_mutex`
- `std::try_lock`
- `scoped_lock` with more than one mutex
- `shared_lock`
- `unique_lock`
Some of them can probably be annotated today, but at least some of them require new attributes to support properly. I also noticed that `shared_mutex` and `shared_timed_mutex` do have annotations, but use `[[clang::capability]]` while there is also `[[clang::shared_capability]]`. Should they be changed to use the `shared_` annotation instead?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsVE1v4zgM_TXyhWjgKLWdHHzoBwLseeY-oCU60o4suRKVrv_9Qk7dZjAFBBigRPK9Rz5jSvbiiXrRPIvmtcLMJsR-NtZ5-7vrumoIeul_GgKVYyTPwCYSakg4Ei-A3gdGtsEDMkc7ZKYEOnghOwYVrhSBDcGYnYPE6DVGDc4OEeMCKccRFQn5Au_GKgM2wVu2TJD9GCJnj0w7eLm1dsutVHAuvFt_gZGQc7zrZ_BKgP4eVgLrSz8l5HM5hydRl_MAoq0jqRyTvdKvKTP9J9p6u2E7kf4r-vX--_vEujQ4PHFcfrmgft_fqTCT3qLwbtnAFCIBG_QQPMGt2vbcYPx6vkWzt2-Z7qKifvoRJoIwFm0mUOhhjmHAwS0w0CYEaeCgcSlKD5kBGRxhYkj3yZHeso0Ent7vp8kBUp7nELmUnim6ZQf_ALoUwAe2qlQ3yHewN2EAvb4L_6ka6LBN7HNaG8CcqOSta_msHPrLTViFMw7WWV5E81pOkdJYV2SkSGWBVlzf5X6A-KbEDn6YkF2hQatsyqC_rKKtSMrafbG48frce-sTE2pxOFe6P-jT4YQV9fuuaZpT3R2byvQtarnfa9W29UA0HlqlZXfqjmMtH7uxfqxsL2vZ1Mf9qT7WrWx2rWpV04yjUvLQ1noQjzVNaN3Oueu0C_FS2ZQy9fvmUR73lcOBXFpdLOVGeYzBM3ktpCzejn3JfRjyJYnH2tnE6asaW3brX-BlTW5e4ecfPteB0s1jWNz3yd9fYMqO7ezob3tv_qxydL1hnlMZhDwLeb5YNnnYqTAJeS4oPj4Pcwz_kmIhzyvBJOT5g-O1l_8HAAD__7dnkgU">