OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::SpinMutex Class Reference

Handy little spin mutex for the cached meshes. Implements the "Lockable" concept. More...

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/MTUtils.hpp>

Public Member Functions

 SpinMutex ()
void lock ()
bool try_lock ()
void unlock ()

Private Attributes

std::atomic_flag m_flg

Static Private Attributes

static const auto MO_ACQ = std::memory_order_acquire
static const auto MO_REL = std::memory_order_release

Detailed Description

Handy little spin mutex for the cached meshes. Implements the "Lockable" concept.

Constructor & Destructor Documentation

◆ SpinMutex()

Slic3r::SpinMutex::SpinMutex ( )
inline
27{ m_flg.clear(MO_REL); }
static const auto MO_REL
Definition MTUtils.hpp:24
std::atomic_flag m_flg
Definition MTUtils.hpp:22

References m_flg, and MO_REL.

Member Function Documentation

◆ lock()

void Slic3r::SpinMutex::lock ( )
inline
28{ while (m_flg.test_and_set(MO_ACQ)) ; }
static const auto MO_ACQ
Definition MTUtils.hpp:23

References m_flg, and MO_ACQ.

◆ try_lock()

bool Slic3r::SpinMutex::try_lock ( )
inline
29{ return !m_flg.test_and_set(MO_ACQ); }

References m_flg, and MO_ACQ.

◆ unlock()

void Slic3r::SpinMutex::unlock ( )
inline
30{ m_flg.clear(MO_REL); }

References m_flg, and MO_REL.

Member Data Documentation

◆ m_flg

std::atomic_flag Slic3r::SpinMutex::m_flg
private

Referenced by SpinMutex(), lock(), try_lock(), and unlock().

◆ MO_ACQ

const auto Slic3r::SpinMutex::MO_ACQ = std::memory_order_acquire
staticprivate

Referenced by lock(), and try_lock().

◆ MO_REL

const auto Slic3r::SpinMutex::MO_REL = std::memory_order_release
staticprivate

Referenced by SpinMutex(), and unlock().


The documentation for this class was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/MTUtils.hpp