VTK  9.3.20240419
Public Member Functions | List of all members
vtkAtomicMutex Class Reference

mutual exclusion locking class using atomic operations More...

#include <vtkAtomicMutex.h>

Public Member Functions

 vtkAtomicMutex ()
 
 ~vtkAtomicMutex ()=default
 
 vtkAtomicMutex (const vtkAtomicMutex &other)
 
vtkAtomicMutexoperator= (const vtkAtomicMutex &other)
 
void lock ()
 Lock/Unlock atomic operation. More...
 
void unlock ()
 Lock/Unlock atomic operation. More...
 

Detailed Description

mutual exclusion locking class using atomic operations

vtkAtomicMutex allows the locking of variables which are accessed through different threads using atomic operations. An atomic mutex might be preferable over std::mutex, because it is faster when you want to spin lock and the probability of acquiring the lock is high. The benefit of vtkAtomicMutex over std::atomic<bool> is that it is copy constructible, and that is has predefined optimized lock/unlock functions that can be used as a drop in replacement instead of std::mutex.

Definition at line 23 of file vtkAtomicMutex.h.

Constructor & Destructor Documentation

◆ vtkAtomicMutex() [1/2]

vtkAtomicMutex::vtkAtomicMutex ( )

◆ ~vtkAtomicMutex()

vtkAtomicMutex::~vtkAtomicMutex ( )
default

◆ vtkAtomicMutex() [2/2]

vtkAtomicMutex::vtkAtomicMutex ( const vtkAtomicMutex other)

Member Function Documentation

◆ operator=()

vtkAtomicMutex& vtkAtomicMutex::operator= ( const vtkAtomicMutex other)

◆ lock()

void vtkAtomicMutex::lock ( )

Lock/Unlock atomic operation.

Note: lock/unlock is lowercase, to conform to the mutex wrapper std::lock_guard which provides a convenient RAII-style mechanism for owning a mutex for the duration of a scoped block.

◆ unlock()

void vtkAtomicMutex::unlock ( )

Lock/Unlock atomic operation.

Note: lock/unlock is lowercase, to conform to the mutex wrapper std::lock_guard which provides a convenient RAII-style mechanism for owning a mutex for the duration of a scoped block.


The documentation for this class was generated from the following file: