This class provides a full specialization of RecursiveMutexImpl for pthreads. If the pthreads implementation supports the "recursive" attribute, then the native implementation is used, otherwise, a portable, efficient implementation is provided.

Synopsis

Declared in <bslmt_recursivemuteximpl_pthread.h>

Member Functions

Name

Description

RecursiveMutexImpl [constructor]

Create a recursive mutex initialized to an unlocked state. This method does not return normally unless there are sufficient system resources to construct the object.

~RecursiveMutexImpl [destructor]

Destroy this recursive mutex object.

lock

Acquire a lock on this mutex object. If this object is currently locked by a different thread, then suspend execution of the current thread until a lock can be acquired. Otherwise, if it unlocked, or locked by the calling thread, then grant ownership of the lock immediately and return. Note that when this object is recursively locked by a thread, unlock must be called an equal number of times before the lock is actually released.

tryLock

Attempt to acquire a lock on this mutex object. If this object is unlocked, or locked by the calling thread, then grant ownership of the lock immediately and return 0. Otherwise If this object is currently locked by a different thread or if an error occurs, then return a non‐zero value. Note that when this object is recursively locked by a thread, unlock must be called an equal number of times before the lock is actually released.

unlock

Release a lock on this mutex that was previously acquired through a successful call to lock, or tryLock. The behavior is undefined, unless the calling thread currently owns the lock on this mutex. Note that when this object is recursively locked by a thread, unlock must be called an equal number of times before the lock is actually released.

Created with MrDocs