BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslmt::QLock Struct Reference

#include <bslmt_qlock.h>

Public Member Functions

void initialize ()
 Set this lock into the initial unlocked state.
 
bool isLocked () const
 Return true if this lock is locked and false otherwise.
 

Public Attributes

bsls::AtomicOperations::AtomicTypes::Pointer d_guardQueueTail
 

Detailed Description

An efficient statically-initializable synchronization primitive that enables serialized access to shared resources. Objects of this class can only be manipulated through the use of a QLockGuard. The following idiom is used to initialize objects of type QLock:

#define BSLMT_QLOCK_INITIALIZER
Definition bslmt_qlock.h:258
Definition bslmt_qlock.h:271

Member Function Documentation

◆ initialize()

void bslmt::QLock::initialize ( )
inline

◆ isLocked()

bool bslmt::QLock::isLocked ( ) const
inline

Member Data Documentation

◆ d_guardQueueTail

bsls::AtomicOperations::AtomicTypes::Pointer bslmt::QLock::d_guardQueueTail

Pointer to the last guard in the queue of guards waiting for this lock, or 0 if the lock is unlocked.

Note that the first guard in the queue owns the lock so that d_guardQueueTail points to the owner of the lock when the lock is locked and there are no additional guards waiting.

It would have been preferable for this member to be private, but then this class would not be statically initializable. Also, it would have been preferable to make this member an instance of bsls::AtomicPointer<>, but again, we would lose the ability to initialize statically.


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