ADTF  3.18.2
fast_mutex

Fast mutex class, implemented as an atomic spin lock with very low CPU overhead. More...

Public Types

typedef void * native_handle_type
 Type of a native handle.
 

Public Member Functions

 fast_mutex ()
 CTOR.
 
 ~fast_mutex ()
 DTOR.
 
void lock ()
 Lock the mutex.
 
bool try_lock ()
 Try to lock the mutex. More...
 
void unlock ()
 Unlock the mutex.
 
native_handle_type native_handle ()
 Get the native handle of the mutex. More...
 

Private Attributes

a_util::memory::StackPtr< Implementation, 64 > _impl
 

Detailed Description

Fast mutex class, implemented as an atomic spin lock with very low CPU overhead.

Definition at line 23 of file fast_mutex.h.

Member Function Documentation

◆ native_handle()

native_handle_type native_handle ( )

Get the native handle of the mutex.

Returns
Pointer to the native handle of the mutex. On Windows this is a pointer to struct CRITICAL_SECTION. On POSIX this is a pointer to struct pthread_mutex_t.

◆ try_lock()

bool try_lock ( )

Try to lock the mutex.

Returns
true if locking succeeded, false otherwise.