mirror of
https://github.com/boostorg/math.git
synced 2026-02-24 04:02:18 +00:00
Remove boost::lightweight_mutex
This commit is contained in:
@@ -10,10 +10,10 @@
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
#include <typeinfo>
|
||||
#include <mutex>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
#include <boost/math/special_functions/next.hpp>
|
||||
#include <boost/math/tools/atomic.hpp>
|
||||
#include <boost/detail/lightweight_mutex.hpp>
|
||||
|
||||
namespace boost{ namespace math{ namespace quadrature { namespace detail{
|
||||
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
void extend_refinements()const
|
||||
{
|
||||
#ifndef BOOST_MATH_NO_ATOMIC_INT
|
||||
boost::detail::lightweight_mutex::scoped_lock guard(m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
#endif
|
||||
//
|
||||
// Check some other thread hasn't got here after we read the atomic variable, but before we got here:
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
std::size_t m_max_refinements;
|
||||
#ifndef BOOST_MATH_NO_ATOMIC_INT
|
||||
mutable boost::math::detail::atomic_unsigned_type m_committed_refinements;
|
||||
mutable boost::detail::lightweight_mutex m_mutex;
|
||||
mutable std::mutex m_mutex;
|
||||
#else
|
||||
mutable unsigned m_committed_refinements;
|
||||
#endif
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <typeinfo>
|
||||
#include <mutex>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
#include <boost/math/tools/atomic.hpp>
|
||||
#include <boost/detail/lightweight_mutex.hpp>
|
||||
#include <boost/math/policies/error_handling.hpp>
|
||||
#include <boost/math/special_functions/trunc.hpp>
|
||||
|
||||
@@ -84,7 +84,7 @@ private:
|
||||
void extend_refinements()const
|
||||
{
|
||||
#ifndef BOOST_MATH_NO_ATOMIC_INT
|
||||
boost::detail::lightweight_mutex::scoped_lock guard(m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
#endif
|
||||
//
|
||||
// Check some other thread hasn't got here after we read the atomic variable, but before we got here:
|
||||
@@ -129,7 +129,7 @@ private:
|
||||
std::size_t m_max_refinements;
|
||||
#ifndef BOOST_MATH_NO_ATOMIC_INT
|
||||
mutable boost::math::detail::atomic_unsigned_type m_committed_refinements;
|
||||
mutable boost::detail::lightweight_mutex m_mutex;
|
||||
mutable std::mutex m_mutex;
|
||||
#else
|
||||
mutable unsigned m_committed_refinements;
|
||||
#endif
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
#include <boost/math/tools/atomic.hpp>
|
||||
#include <boost/detail/lightweight_mutex.hpp>
|
||||
#include <typeinfo>
|
||||
#include <mutex>
|
||||
#include <boost/math/tools/atomic.hpp>
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
#include <boost/math/special_functions/next.hpp>
|
||||
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
void extend_refinements()const
|
||||
{
|
||||
#ifndef BOOST_MATH_NO_ATOMIC_INT
|
||||
boost::detail::lightweight_mutex::scoped_lock guard(m_mutex);
|
||||
std::lock_guard<std::mutex> guard(m_mutex);
|
||||
#endif
|
||||
//
|
||||
// Check some other thread hasn't got here after we read the atomic variable, but before we got here:
|
||||
@@ -172,7 +172,7 @@ private:
|
||||
std::size_t m_max_refinements, m_inital_row_length;
|
||||
#ifndef BOOST_MATH_NO_ATOMIC_INT
|
||||
mutable boost::math::detail::atomic_unsigned_type m_committed_refinements;
|
||||
mutable boost::detail::lightweight_mutex m_mutex;
|
||||
mutable std::mutex m_mutex;
|
||||
#else
|
||||
mutable unsigned m_committed_refinements;
|
||||
#endif
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#define BOOST_MATH_BERNOULLI_DETAIL_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/lightweight_mutex.hpp>
|
||||
#include <boost/math/tools/atomic.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/math/tools/toms748_solve.hpp>
|
||||
#include <boost/math/tools/cxx03_warn.hpp>
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <vector>
|
||||
#include <mutex>
|
||||
|
||||
namespace boost{ namespace math{ namespace detail{
|
||||
//
|
||||
@@ -423,7 +423,7 @@ public:
|
||||
//
|
||||
// We need to grab a mutex every time we get here, for both readers and writers:
|
||||
//
|
||||
boost::detail::lightweight_mutex::scoped_lock l(m_mutex);
|
||||
std::lock_guard<std::mutex> l(m_mutex);
|
||||
if(m_current_precision < boost::math::tools::digits<T>())
|
||||
{
|
||||
bn.clear();
|
||||
@@ -453,7 +453,7 @@ public:
|
||||
if((static_cast<std::size_t>(m_counter.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < start + n)
|
||||
|| (static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>()))
|
||||
{
|
||||
boost::detail::lightweight_mutex::scoped_lock l(m_mutex);
|
||||
std::lock_guard<std::mutex> l(m_mutex);
|
||||
|
||||
if((static_cast<std::size_t>(m_counter.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < start + n)
|
||||
|| (static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>()))
|
||||
@@ -558,7 +558,7 @@ public:
|
||||
//
|
||||
// We need to grab a mutex every time we get here, for both readers and writers:
|
||||
//
|
||||
boost::detail::lightweight_mutex::scoped_lock l(m_mutex);
|
||||
std::lock_guard<std::mutex> l(m_mutex);
|
||||
if(m_current_precision < boost::math::tools::digits<T>())
|
||||
{
|
||||
bn.clear();
|
||||
@@ -596,7 +596,7 @@ public:
|
||||
if((static_cast<std::size_t>(m_counter.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < start + n)
|
||||
|| (static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>()))
|
||||
{
|
||||
boost::detail::lightweight_mutex::scoped_lock l(m_mutex);
|
||||
std::lock_guard<std::mutex> l(m_mutex);
|
||||
|
||||
if((static_cast<std::size_t>(m_counter.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < start + n)
|
||||
|| (static_cast<int>(m_current_precision.load(BOOST_MATH_ATOMIC_NS::memory_order_consume)) < boost::math::tools::digits<T>()))
|
||||
@@ -649,10 +649,10 @@ private:
|
||||
#if !defined(BOOST_HAS_THREADS)
|
||||
int m_current_precision;
|
||||
#elif defined(BOOST_MATH_NO_ATOMIC_INT)
|
||||
boost::detail::lightweight_mutex m_mutex;
|
||||
std::mutex m_mutex;
|
||||
int m_current_precision;
|
||||
#else
|
||||
boost::detail::lightweight_mutex m_mutex;
|
||||
std::mutex m_mutex;
|
||||
atomic_counter_type m_counter, m_current_precision;
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user