17 #ifndef AGX_SPINMUTEX_H
18 #define AGX_SPINMUTEX_H
20 #include <agx/config/AGX_USE_SSE.h>
21 #include <agx/config/AGX_DEBUG_SYNCHRONIZATION_OVERHEAD_TESTING.h>
29 #include <xmmintrin.h>
30 #include <emmintrin.h>
35 # pragma warning(push)
36 # pragma warning( disable : 4275 )
37 # pragma warning(disable: 4251)
82 bool isLocked()
const;
85 std::atomic<int> m_lock;
105 #if AGX_DEBUG_SYNCHRONIZATION_OVERHEAD_TESTING()
109 agx::Int32 prev = m_lock.exchange(1, std::memory_order_acquire);
116 prev = m_lock.exchange(1, std::memory_order_acquire);
122 #if AGX_DEBUG_SYNCHRONIZATION_OVERHEAD_TESTING()
126 m_lock.store(0, std::memory_order_release);
131 #if AGX_DEBUG_SYNCHRONIZATION_OVERHEAD_TESTING()
135 int32_t prev = m_lock.exchange(1, std::memory_order_acquire);
141 #if AGX_DEBUG_SYNCHRONIZATION_OVERHEAD_TESTING()
145 int32_t prev = m_lock.exchange(1, std::memory_order_acquire);
151 return m_lock.load( std::memory_order_relaxed ) != 0;
156 # pragma warning(pop)
void unlock()
Unlock the mutex.
void lock()
Lock the mutex.
bool trylock()
Deprecated.
SpinMutex & operator=(const SpinMutex &other)
bool isLocked() const
Debug.
SpinMutex(const SpinMutex &other)
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AGXCORE_EXPORT bool forcedShutdown()