mirror of git://gcc.gnu.org/git/gcc.git
libstdc++: Include <mutex> in syncbuf.cc [PR122698]
For most configurations bits/std_mutex.h would already be included by <syncstream>, but not if configured with _GLIBCXX_USE_CXX11_ABI=0 as the default, because syncbuf is disabled in that case. libstdc++-v3/ChangeLog: PR libstdc++/122698 * src/c++20/syncbuf.cc (__syncbuf_get_mutex): Include <mutex>. Fix indentation of function body.
This commit is contained in:
parent
d9a19e6805
commit
84dbb22f32
|
|
@ -23,6 +23,7 @@
|
||||||
// <http://www.gnu.org/licenses/>.
|
// <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include <syncstream>
|
#include <syncstream>
|
||||||
|
#include <mutex>
|
||||||
#include <bits/functional_hash.h>
|
#include <bits/functional_hash.h>
|
||||||
|
|
||||||
#if _GLIBCXX_HAS_GTHREADS
|
#if _GLIBCXX_HAS_GTHREADS
|
||||||
|
|
@ -32,13 +33,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
|
|
||||||
mutex&
|
mutex&
|
||||||
__syncbuf_get_mutex(void* __t)
|
__syncbuf_get_mutex(void* __t)
|
||||||
{
|
{
|
||||||
const unsigned char __mask = 0xf;
|
const unsigned char __mask = 0xf;
|
||||||
static mutex __m[__mask + 1];
|
static mutex __m[__mask + 1];
|
||||||
|
|
||||||
auto __key = _Hash_impl::hash(__t) & __mask;
|
auto __key = _Hash_impl::hash(__t) & __mask;
|
||||||
return __m[__key];
|
return __m[__key];
|
||||||
}
|
}
|
||||||
|
|
||||||
_GLIBCXX_END_NAMESPACE_VERSION
|
_GLIBCXX_END_NAMESPACE_VERSION
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue