Public Member Functions |
void | access (void) |
| Acquire access (shared read) lock.
|
void | commit (void) |
| Commit changes / release a modify lock.
|
| ConditionalLock () |
| Construct conditional lock for default concurrency.
|
void | exclusive (void) |
| Convert read lock into exclusive (write/modify) access.
|
unsigned | getReaders (void) |
| Get the number of threads reading (sharing) the lock.
|
unsigned | getWaiters (void) |
| Get the number of threads waiting to share the lock.
|
void | modify (void) |
| Acquire write (exclusive modify) lock.
|
void | release (void) |
| Release a shared lock.
|
void | share (void) |
| Return an exclusive access lock back to share mode.
|
| ~ConditionalLock () |
| Destroy conditional lock.
|
Static Public Member Functions |
static void | access (ConditionalLock &lock) |
| Convenience function to aqcuire a shared lock.
|
static void | commit (ConditionalLock &lock) |
| Convenience function to commit a modify lock.
|
static void | exclusive (ConditionalLock &lock) |
| Convenience function to convert lock to exclusive mode.
|
static void | modify (ConditionalLock &lock) |
| Convenience function to modify lock.
|
static void | release (ConditionalLock &lock) |
| Convenience function to release a shared lock.
|
static void | share (ConditionalLock &lock) |
| Convenience function to convert lock to shared access.
|
An optimized and convertable shared lock.
This is a form of read/write lock that has been optimized, particularly for shared access. Support for scheduling access around writer starvation is also included. The other benefits over traditional read/write locks is that the code is a little lighter, and read (shared) locks can be converted to exclusive (write) locks to perform brief modify operations and then returned to read locks, rather than having to release and re-aquire locks to change mode.
- Author:
- David Sugar <dyfet@gnutelephony.org>
Definition at line 797 of file thread.h.