Bayonne2 / Common C++ 2 Framework
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes
ThreadLock Class Reference

The ThreadLock class impliments a thread rwlock for optimal reader performance on systems which have rwlock support, and reverts to a simple mutex for those that do not. More...

#include <thread.h>

Inheritance diagram for ThreadLock:
Inheritance graph
[legend]
Collaboration diagram for ThreadLock:
Collaboration graph
[legend]

Public Member Functions

 ThreadLock ()
 Create a process shared thread lock object. More...
 
virtual ~ThreadLock ()
 Destroy a process shared thread lock object. More...
 
void readLock (void)
 Aquire a read lock for the current object. More...
 
void writeLock (void)
 Aquire a write lock for the current object. More...
 
bool tryReadLock (void)
 Attempt read lock for current object. More...
 
bool tryWriteLock (void)
 Attempt write lock for current object. More...
 
void unlock (void)
 Release any held locks. More...
 

Private Attributes

Mutex mutex
 

Detailed Description

The ThreadLock class impliments a thread rwlock for optimal reader performance on systems which have rwlock support, and reverts to a simple mutex for those that do not.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m Posix rwlock extension for protected access.

Definition at line 357 of file thread.h.

Constructor & Destructor Documentation

ThreadLock::ThreadLock ( )

Create a process shared thread lock object.

virtual ThreadLock::~ThreadLock ( )
virtual

Destroy a process shared thread lock object.

Member Function Documentation

void ThreadLock::readLock ( void  )

Aquire a read lock for the current object.

bool ThreadLock::tryReadLock ( void  )

Attempt read lock for current object.

Returns
true on success.
bool ThreadLock::tryWriteLock ( void  )

Attempt write lock for current object.

Returns
true on success.
void ThreadLock::unlock ( void  )

Release any held locks.

void ThreadLock::writeLock ( void  )

Aquire a write lock for the current object.

Field Documentation

Mutex ThreadLock::mutex
private

Definition at line 363 of file thread.h.


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