atscppapi
1.0.9
C++ wrapper for Apache Traffic Server API
|
A mutex is mutual exclusion: a blocking lock. More...
#include "Mutex.h"
Inherits atscppapi::noncopyable.
Public Types | |
enum | Type { TYPE_NORMAL = 0, TYPE_RECURSIVE, TYPE_ERROR_CHECK } |
Public Member Functions | |
Mutex (Type type=TYPE_NORMAL) | |
bool | tryLock () |
void | lock () |
void | unlock () |
A mutex is mutual exclusion: a blocking lock.
The Mutex class uses pthreads for its implmentation.
The available types of Mutexes.
Enumerator | |
---|---|
TYPE_NORMAL |
This type of Mutex will deadlock if locked by a thread already holding the lock |
TYPE_RECURSIVE |
This type of Mutex will allow a thread holding the lock to lock it again; however, it must be unlocked the same number of times |
TYPE_ERROR_CHECK |
This type of Mutex will return errno = EDEADLCK if a thread would deadlock by taking the lock after it already holds it |
|
inline |
|
inline |
Block until the lock is taken, when this call returns the thread will be holding the lock.
|
inline |
Try to take the lock, this call will NOT block if the mutex cannot be taken.
|
inline |
Unlock the lock, this call is nonblocking.