join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicFutex< LockPolicy > Class Template Reference

Futex-based mutex for intra-process locking. More...

#include <futex.hpp>

Public Member Functions

 BasicFutex () noexcept
 default constructor.
 
 BasicFutex (const BasicFutex &other)=delete
 copy constructor.
 
BasicFutex & operator= (const BasicFutex &other)=delete
 copy assignment.
 
 BasicFutex (BasicFutex &&other)=delete
 move constructor.
 
BasicFutex & operator= (BasicFutex &&other)=delete
 move assignment.
 
 ~BasicFutex ()=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.
 
std::atomic_uint32_t * handle () noexcept
 get a pointer to the underlying futex word.
 

Detailed Description

template<class LockPolicy>
class join::BasicFutex< LockPolicy >

Futex-based mutex for intra-process locking.

Constructor & Destructor Documentation

◆ BasicFutex() [1/3]

template<class LockPolicy >
join::BasicFutex< LockPolicy >::BasicFutex ( )
inlinenoexcept

default constructor.

◆ BasicFutex() [2/3]

template<class LockPolicy >
join::BasicFutex< LockPolicy >::BasicFutex ( const BasicFutex< LockPolicy > & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ BasicFutex() [3/3]

template<class LockPolicy >
join::BasicFutex< LockPolicy >::BasicFutex ( BasicFutex< LockPolicy > && other)
delete

move constructor.

Parameters
otherother object to move.

◆ ~BasicFutex()

template<class LockPolicy >
join::BasicFutex< LockPolicy >::~BasicFutex ( )
default

destructor.

Member Function Documentation

◆ handle()

template<class LockPolicy >
std::atomic_uint32_t * join::BasicFutex< LockPolicy >::handle ( )
inlinenoexcept

get a pointer to the underlying futex word.

Returns
pointer to the atomic futex word.

◆ lock()

template<class LockPolicy >
void join::BasicFutex< LockPolicy >::lock ( )
inlinenoexcept

lock the futex, blocking until it becomes available.

◆ operator=() [1/2]

template<class LockPolicy >
BasicFutex & join::BasicFutex< LockPolicy >::operator= ( BasicFutex< LockPolicy > && other)
delete

move assignment.

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

◆ operator=() [2/2]

template<class LockPolicy >
BasicFutex & join::BasicFutex< LockPolicy >::operator= ( const BasicFutex< LockPolicy > & other)
delete

copy assignment.

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

◆ tryLock()

template<class LockPolicy >
bool join::BasicFutex< LockPolicy >::tryLock ( )
inlinenoexcept

try to lock the futex without blocking.

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

◆ unlock()

template<class LockPolicy >
void join::BasicFutex< LockPolicy >::unlock ( )
inlinenoexcept

unlock the futex.


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