join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::SharedFutex Class Reference

Futex-based mutex suitable for inter-process locking via shared memory. More...

#include <futex.hpp>

Public Member Functions

 SharedFutex () noexcept
 default constructor.
 
 SharedFutex (const SharedFutex &other)=delete
 copy constructor.
 
SharedFutexoperator= (const SharedFutex &other)=delete
 copy assignment.
 
 SharedFutex (SharedFutex &&other)=delete
 move constructor.
 
SharedFutexoperator= (SharedFutex &&other)=delete
 move assignment.
 
 ~SharedFutex ()=default
 destructor.
 
void lock () noexcept
 lock the futex, blocking until it becomes available.
 
bool tryLock () noexcept
 try to lock the futex without blocking.
 
void unlock () noexcept
 unlock the futex, waking one waiter if any.
 
std::atomic_uint32_t * handle () noexcept
 get a pointer to the underlying futex word.
 

Detailed Description

Futex-based mutex suitable for inter-process locking via shared memory.

Constructor & Destructor Documentation

◆ SharedFutex() [1/3]

join::SharedFutex::SharedFutex ( )
inlinenoexcept

default constructor.

◆ SharedFutex() [2/3]

join::SharedFutex::SharedFutex ( const SharedFutex & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ SharedFutex() [3/3]

join::SharedFutex::SharedFutex ( SharedFutex && other)
delete

move constructor.

Parameters
otherother object to move.

◆ ~SharedFutex()

join::SharedFutex::~SharedFutex ( )
default

destructor.

Member Function Documentation

◆ handle()

std::atomic_uint32_t * join::SharedFutex::handle ( )
inlinenoexcept

get a pointer to the underlying futex word.

Returns
pointer to the atomic futex word.

◆ lock()

void join::SharedFutex::lock ( )
inlinenoexcept

lock the futex, blocking until it becomes available.

◆ operator=() [1/2]

SharedFutex & join::SharedFutex::operator= ( const SharedFutex & other)
delete

copy assignment.

Parameters
otherother object to copy.
Returns
a reference to the current object.

◆ operator=() [2/2]

SharedFutex & join::SharedFutex::operator= ( SharedFutex && other)
delete

move assignment.

Parameters
otherother object to move.
Returns
a reference to the current object.

◆ tryLock()

bool join::SharedFutex::tryLock ( )
inlinenoexcept

try to lock the futex without blocking.

Returns
true if the lock was acquired, false if it was already locked.

◆ unlock()

void join::SharedFutex::unlock ( )
inlinenoexcept

unlock the futex, waking one waiter if any.


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