<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/89891>89891</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`std::lock_guard` is unavailable when `_LIBCPP_HAS_NO_THREADS` is set
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
petrhosek
</td>
</tr>
</table>
<pre>
When `_LIBCPP_HAS_NO_THREADS` is set,`std::lock_guard` becomes unavailable: https://github.com/llvm/llvm-project/blob/662ef8604268b207910225ecca90daf30a46720b/libcxx/include/__mutex/lock_guard.h#L19-L51
`std::lock_guard` takes mutex implementation as a template argument, so even if the platform doesn't support standard threading API, users may still want to use it with their own custom mutex implementation which is common on baremetal platforms.
This is related to issue https://github.com/llvm/llvm-project/issues/84879.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykU01r3DAQ_TXyZcgij73-OPiwSWoSCG1oAj0usjW7ViNLRhpnk39ftLRNCw20FIQEozdv3nypGM3REXVieym215laefKhW4jD5CM9ZYPXr92XiRyISu7vbi-v7u_3N7uH_cdP-8ebzx921w-ikmAiRGKBV6KSkbUodqLYWT8-7Y-rCjpBBhr9TBFWp56VsWqwJIodTMxLTHjsBfZHw9M6bEY_C-ytff7xXCzBf6WRBfaD9YPAvqqQDk0lS6yaAWXd5hJxS-OoWqnVoZCqrGqUCWrNML68COyNG-2qSWC_388rU7K9idxMAou7vL242-ZCXgu5-36_mxKrJ4pwZgIzL5ZmcqzYeAcqggKmebGKCVQ4rulP4BVED_RMDswBeCJIgIMPM2hP0QmsGeK6LD4wRFZOq6CBp0BKG3eE3f1t4lgjhQizeoXIxlo4KcfAPtnBMJwMT4ncBPAnB-Ma2c9_1nmazDil9o1-nr0D72BQgWZiZX9qi5tf6_E4mZg8AqXcdIprYlzp31t5dosC-6Zs6naT6a7QbdGqjLq8zou2rLHMs6kbFMq2rimvD-W2yrdUk9JNS-UWB8S6ykyHEktZYikbrDHf5LmssdLtIR_GknQpSkmzMnaTFGx8OGbn2F3TNm2eWTWQjecdQEzTIvDyfDDtROjOsof1GEUprYkc32jYsKXu_RExvw08nP5yk7I12O4_6pnS-hYAAP__olBAoQ">