BRE12
Classes | Public Member Functions | Static Public Attributes | Protected Types | Protected Attributes | Static Protected Attributes | List of all members
tbb::spin_rw_mutex_v3 Class Reference

Fast, unfair, spinning reader-writer lock with backoff and writer-preference. More...

#include <spin_rw_mutex.h>

Inheritance diagram for tbb::spin_rw_mutex_v3:

Classes

class  scoped_lock
 The scoped locking pattern. More...
 

Public Member Functions

 spin_rw_mutex_v3 ()
 Construct unacquired mutex.
 
void lock ()
 Acquire writer lock.
 
bool try_lock ()
 Try acquiring writer lock (non-blocking) More...
 
void unlock ()
 Release lock.
 
void lock_read ()
 Acquire reader lock.
 
bool try_lock_read ()
 Try acquiring reader lock (non-blocking) More...
 

Static Public Attributes

static const bool is_rw_mutex = true
 
static const bool is_recursive_mutex = false
 
static const bool is_fair_mutex = false
 

Protected Types

typedef intptr_t state_t
 

Protected Attributes

state_t state
 State of lock. More...
 

Static Protected Attributes

static const state_t WRITER = 1
 
static const state_t WRITER_PENDING = 2
 
static const state_t READERS = ~(WRITER | WRITER_PENDING)
 
static const state_t ONE_READER = 4
 
static const state_t BUSY = WRITER | READERS
 

Detailed Description

Fast, unfair, spinning reader-writer lock with backoff and writer-preference.

Member Function Documentation

§ try_lock()

bool tbb::spin_rw_mutex_v3::try_lock ( )
inline

Try acquiring writer lock (non-blocking)

Return true if lock acquired; false otherwise.

§ try_lock_read()

bool tbb::spin_rw_mutex_v3::try_lock_read ( )
inline

Try acquiring reader lock (non-blocking)

Return true if reader lock acquired; false otherwise.

Member Data Documentation

§ state

state_t tbb::spin_rw_mutex_v3::state
protected

State of lock.

Bit 0 = writer is holding lock Bit 1 = request by a writer to acquire lock (hint to readers to wait) Bit 2..N = number of readers holding lock


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