class semlock Class to automatically lock and unlock a mutex.
| | rdlock read lock |
| | wrlock write lock |
| | semlock (abstractsemaphore& sem) Default constructor. |
| | semlock (abstractsemaphore& sem, locktype lck) Default constructor. |
| | ~semlock () Default destructor. |
| | locktype type of lock |
This class can be used to automatically lock and unlock a semaphore over the duration of a function call. semlock has to be initialized with an mutex, a recursive mutex or a read/write lock. Upon contruction of the object the semaphore is locked. When the object is destroyed the semaphore is automatically freed.Example: mutex mux; void foobar () { mutexlock lockit (mux); // statements of foobar here }Since an object is automatically destroyed at the end of its context, semlock can also be used in loops and branches of conditional statments, or in any compound statement to protect a resource for the duration of the context.
rdlock
wrlock
explicit semlock(abstractsemaphore& sem)
semlock(abstractsemaphore& sem, locktype lck)
virtual ~semlock()
alphabetic index hierarchy of classes
Please send questions and comments to zweizig_j@ligo.caltech.edu
generated by doc++