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.
|
virtual void | Exclusive (void) |
| Convert object to an exclusive lock.
|
void | Lock (void) |
| A convenience member function for accessing the shared lock.
|
virtual void | Share (void) |
| Share the lock with other referencers.
|
virtual void | Shlock (void)=0 |
| Protocol interface to share lock the object.
|
virtual void | Unlock (void)=0 |
| Protocol interface to release a lock.
|
Protected Member Functions |
void | Exclusive (void) |
Context * | getContext (void) |
void | Share (void) |
void | Shlock (void) |
void | Unlock (void) |
| ConditionalAccess () |
| Initialize and construct conditional.
|
void | limit_sharing (unsigned max) |
| Specify a maximum sharing (access) limit.
|
| ~ConditionalAccess () |
| Destroy conditional, release any blocked threads.
|
void | broadcast (void) |
| Signal the conditional to release all broadcast threads.
|
void | lock (void) |
| Lock the conditional's supporting mutex.
|
void | signal (void) |
| Signal the conditional to release one signalled thread.
|
void | unlock (void) |
| Unlock the conditional's supporting mutex.
|
bool | waitBroadcast (timeout_t timeout) |
| Conditional wait for broadcast on millisecond timeout.
|
bool | waitBroadcast (struct timespec *timeout) |
| Conditional wait for broadcast on timespec timeout.
|
void | waitBroadcast (void) |
| Wait (block) until broadcast.
|
bool | waitSignal (timeout_t timeout) |
| Conditional wait for signal on millisecond timeout.
|
bool | waitSignal (struct timespec *timeout) |
| Conditional wait for signal on timespec timeout.
|
void | waitSignal (void) |
| Wait (block) until signalled.
|
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.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 806 of file thread.h.