Update detail/mutex.hpp to use std::shared_mutex under the MS STL

This commit is contained in:
Peter Dimov
2023-01-19 18:05:21 +02:00
parent 4bca94ffc4
commit 8449c62162

View File

@ -31,6 +31,28 @@ struct mutex
} // namespace system
} // namespace boost
#elif defined(BOOST_MSSTL_VERSION) && BOOST_MSSTL_VERSION >= 140
// Under the MS STL, std::mutex::mutex() is not constexpr, as is
// required by the standard, which leads to initialization order
// issues. However, shared_mutex is based on SRWLock and its
// default constructor is constexpr, so we use that instead.
#include <shared_mutex>
namespace boost
{
namespace system
{
namespace detail
{
typedef std::shared_mutex mutex;
} // namespace detail
} // namespace system
} // namespace boost
#else
#include <mutex>