ucommon::ConditionalLock Class Reference

An optimized and convertable shared lock. More...

#include <thread.h>

Inheritance diagram for ucommon::ConditionalLock:
Inheritance graph
[legend]
Collaboration diagram for ucommon::ConditionalLock:
Collaboration graph
[legend]

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

LinkedObjectcontexts

Detailed Description

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 714 of file thread.h.


Member Function Documentation

virtual void ucommon::ConditionalLock::exclusive ( void   )  [virtual]

Convert read lock into exclusive (write/modify) access.

Schedule when other readers sharing.

Reimplemented from ucommon::SharedAccess.


The documentation for this class was generated from the following file:

Generated on 30 Jul 2013 for UCommon by  doxygen 1.6.1