Tkrzw
Public Member Functions | List of all members
tkrzw::SpinMutex Class Referencefinal

Spin lock mutex. More...

#include <tkrzw_thread_util.h>

Public Member Functions

 SpinMutex ()
 Constructor. More...
 
 SpinMutex (const SpinMutex &rhs)=delete
 Copy and assignment are disabled. More...
 
SpinMutexoperator= (const SpinMutex &rhs)=delete
 
void lock ()
 Gets exclusive ownership of the lock. More...
 
bool try_lock ()
 Tries to get exclusive ownership of the lock. More...
 
void unlock ()
 Releases exclusive ownership of the lock. More...
 

Detailed Description

Spin lock mutex.

Constructor & Destructor Documentation

◆ SpinMutex() [1/2]

tkrzw::SpinMutex::SpinMutex ( )

Constructor.

◆ SpinMutex() [2/2]

tkrzw::SpinMutex::SpinMutex ( const SpinMutex rhs)
explicitdelete

Copy and assignment are disabled.

Member Function Documentation

◆ lock()

void tkrzw::SpinMutex::lock ( )

Gets exclusive ownership of the lock.

Precondition: The thread doesn't have the exclusive ownership.

◆ try_lock()

bool tkrzw::SpinMutex::try_lock ( )

Tries to get exclusive ownership of the lock.

Returns
True if successful or false on failure.

Precondition: The thread doesn't have the exclusive ownership.

◆ unlock()

void tkrzw::SpinMutex::unlock ( )

Releases exclusive ownership of the lock.

Precondition: The thread has the exclusive ownership.