An optimized and convertable shared lock. More...
#include <thread.h>
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. | |
virtual void | exclusive (void) |
Convert read lock into exclusive (write/modify) access. | |
void | modify (void) |
Acquire write (exclusive modify) lock. | |
void | release (void) |
Release a shared lock. | |
virtual void | share (void) |
Return an exclusive access lock back to share mode. | |
~ConditionalLock () | |
Destroy conditional lock. | |
Protected Member Functions | |
virtual void | _share (void) |
Access interface to share lock the object. | |
virtual void | _unlock (void) |
Context * | getContext (void) |
Protected Attributes | |
LinkedObject * | contexts |
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.
Definition at line 714 of file thread.h.
virtual void ucommon::ConditionalLock::exclusive | ( | void | ) | [virtual] |
Convert read lock into exclusive (write/modify) access.
Schedule when other readers sharing.
Reimplemented from ucommon::SharedAccess.