This class implements a mutex, that has the additional capability to keep track of hold time and wait time. The hold time is defined as the cumulative duration for which the mutex was in the locked state. The wait time is defined as the duration for which threads waited for the mutex.
Synopsis
Declared in <bslmt_meteredmutex.h>
class MeteredMutex;
Member Functions
Name |
Description |
|
Create a metered mutex in the unlocked state. |
|
Destroy this metered mutex. |
Return the hold time (in nanoseconds) accumulated since the most recent call to |
|
Return the time in nanoseconds (referenced to an arbitrary but fixed origin) of the most recent invocation to |
|
Acquire the lock on this metered mutex. If this mutex is currently locked, suspend the execution of the current thread until the lock can be acquired. Update the wait and hold time appropriately. The behavior is undefined if the calling thread already owns the lock. |
|
Reset the wait and hold time to zero and record the current time. All subsequent calls (that are made before a subsequent call to |
|
Attempt to acquire the lock on this metered mutex. Return 0 on success, and a non‐zero value if this mutex is already locked, or if an error occurs. Update the wait and hold time appropriately. The behavior is undefined if the calling thread already owns the lock. |
|
Release the lock on this mutex that was previously acquired through a successful call to |
|
Return the wait time (in nanoseconds), accumulated since the most recent call to |
Created with MrDocs