carb::tasking::SpinMutex

Defined in carb/tasking/TaskingUtils.h

struct SpinMutex

This atomic spin lock conforms to C++ Named Requirements of Lockable which makes it compatible with std::lock_guard.

Public Functions

constexpr SpinMutex() noexcept = default

Constructs the SpinMutex.

inline void lock() noexcept

Spins until the lock is acquired.

See § 30.4.1.2.1 in the C++11 standard.

inline bool try_lock() noexcept

Attempts to acquire the lock, on try, returns true if the lock was acquired.

inline void unlock() noexcept

Unlocks, wait-free.

See § 30.4.1.2.1 in the C++11 standard.

inline bool is_locked() const noexcept

Indicates if the mutex is locked.

Returns

true if the mutex is locked with very high probability, false otherwise.