GRATgen
Public Member Functions | List of all members
spinlock Class Reference

Simple spinlock. More...

Public Member Functions

 spinlock ()
 Constructor.
 
bool acquire (size_t max_retries)
 Try to acquire the lock. More...
 
void acquire ()
 Acquire the lock. More...
 
void release ()
 Release the lock. More...
 

Detailed Description

Simple spinlock.

Member Function Documentation

◆ acquire() [1/2]

void spinlock::acquire ( )
inline

Acquire the lock.

Busy-wait as long as the lock is acquired.

◆ acquire() [2/2]

bool spinlock::acquire ( size_t  max_retries)
inline

Try to acquire the lock.

Parameters
max_retriesMaximum number of retries if first acquisition fails
Returns
True if acquisition successful.

◆ release()

void spinlock::release ( )
inline

Release the lock.

Precondition
Lock must be acquired by the calling thread.

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