GMP 0.3.0
Generative Metaprogramming library for C++
Loading...
Searching...
No Matches
gmp::dp::spin_lock Class Reference

A minimal spin lock built on std::atomic_flag. More...

#include <lock.hpp>

Public Member Functions

void lock ()
 Acquire the lock by spinning until it becomes available.
 
void unlock ()
 Release the lock.
 

Detailed Description

spin_lock provides a tiny mutual-exclusion primitive for short critical sections. It repeatedly attempts to acquire the lock until it succeeds.

Warning
Because this lock busy-waits, it should only be used for brief low-contention regions. It is not a replacement for heavier blocking mutexes when waiting may be prolonged.
Since
version 1.0.0

Definition at line 39 of file lock.hpp.

Member Function Documentation

◆ lock()

void gmp::dp::spin_lock::lock ( )
inline

Definition at line 47 of file lock.hpp.

◆ unlock()

void gmp::dp::spin_lock::unlock ( )
inline

Definition at line 54 of file lock.hpp.


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