This class provides a full specialization of MutexImpl for pthreads. It provides a efficient proxy for the pthread_mutex_t pthreads type, and related operations. Note that the mutex implemented in this class is not error checking, and is non-recursive.
Declared in <bslmt_muteximpl_pthread.h>
template<>
class MutexImpl<Platform::PosixThreads>;
| Name | Description |
|---|---|
NativeType | The underlying OS-level type. Exposed so that other bslmt components can operate directly on this mutex. |
| Name | Description |
|---|---|
MutexImpl [constructor] | Create a mutex initialized to an unlocked state. This method does not return normally unless there are sufficient system resources to construct the object. |
~MutexImpl [destructor] | Destroy this mutex object. The behavior is undefined if the mutex is in a locked state. |
lock | Acquire a lock on this mutex object. If this object is currently locked, then suspend execution of the current thread until a lock can be acquired. Note that the behavior is undefined if the calling thread already owns the lock on this mutex, and will likely result in a deadlock. |
nativeMutex | Return a reference to the modifiable OS-level mutex underlying this object. This method is intended only to support other bslmt components that must operate directly on this mutex. |
tryLock | Attempt to acquire a lock on this mutex object. Return 0 on success, and a non-zero value of this object is already locked, or if an error occurs. |
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. |