summaryrefslogtreecommitdiff
path: root/boost/fiber/detail/spinlock.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/fiber/detail/spinlock.hpp')
-rw-r--r--boost/fiber/detail/spinlock.hpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/boost/fiber/detail/spinlock.hpp b/boost/fiber/detail/spinlock.hpp
index 89a6d51a6f..59d2a5cd2b 100644
--- a/boost/fiber/detail/spinlock.hpp
+++ b/boost/fiber/detail/spinlock.hpp
@@ -13,11 +13,14 @@
#if !defined(BOOST_FIBERS_NO_ATOMICS)
# include <mutex>
-# include <boost/fiber/detail/spinlock_ttas.hpp>
# include <boost/fiber/detail/spinlock_ttas_adaptive.hpp>
+# include <boost/fiber/detail/spinlock_ttas.hpp>
# if defined(BOOST_FIBERS_HAS_FUTEX)
-# include <boost/fiber/detail/spinlock_ttas_futex.hpp>
# include <boost/fiber/detail/spinlock_ttas_adaptive_futex.hpp>
+# include <boost/fiber/detail/spinlock_ttas_futex.hpp>
+# endif
+# if defined(BOOST_USE_TSX)
+# include <boost/fiber/detail/spinlock_rtm.hpp>
# endif
#endif
@@ -29,7 +32,7 @@ namespace boost {
namespace fibers {
namespace detail {
-#if defined(BOOST_FIBERS_NO_ATOMICS)
+#if defined(BOOST_FIBERS_NO_ATOMICS)
struct spinlock {
constexpr spinlock() noexcept {}
void lock() noexcept {}
@@ -42,16 +45,32 @@ struct spinlock_lock {
void unlock() noexcept {}
};
#else
-# if defined(BOOST_FIBERS_SPINLOCK_STD_MUTEX)
+# if defined(BOOST_FIBERS_SPINLOCK_STD_MUTEX)
using spinlock = std::mutex;
# elif defined(BOOST_FIBERS_SPINLOCK_TTAS_FUTEX)
+# if defined(BOOST_USE_TSX)
+using spinlock = spinlock_rtm< spinlock_ttas_futex >;
+# else
using spinlock = spinlock_ttas_futex;
+# endif
# elif defined(BOOST_FIBERS_SPINLOCK_TTAS_ADAPTIVE_FUTEX)
+# if defined(BOOST_USE_TSX)
+using spinlock = spinlock_rtm< spinlock_ttas_adaptive_futex >;
+# else
using spinlock = spinlock_ttas_adaptive_futex;
-# elif defined(BOOST_FIBERS_SPINLOCK_TTAS_ADAPTIVE)
+# endif
+# elif defined(BOOST_FIBERS_SPINLOCK_TTAS_ADAPTIVE)
+# if defined(BOOST_USE_TSX)
+using spinlock = spinlock_rtm< spinlock_ttas_adaptive >;
+# else
using spinlock = spinlock_ttas_adaptive;
+# endif
# else
+# if defined(BOOST_USE_TSX)
+using spinlock = spinlock_rtm< spinlock_ttas >;
+# else
using spinlock = spinlock_ttas;
+# endif
# endif
using spinlock_lock = std::unique_lock< spinlock >;
#endif