cpp-pthread  (v1.7.3)
Simple C++ wrapper to pthread functions.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pthread::read_lock Class Reference

#include <read_write_lock.hpp>

Inheritance diagram for pthread::read_lock:
pthread::write_lock

Public Member Functions

void lock ()
 
void try_lock ()
 
void unlock ()
 
virtual ~read_lock ()
 

Protected Member Functions

 read_lock ()
 

Protected Attributes

pthread_rwlock_t _rwlock
 

Detailed Description

This class acquires the read lock.

This class cannot be instaiated as it's main putpose is to implement read locks. To use a read lock create either a read_write_lock or a write_lock.

Author
herbert koelman (herbe.nosp@m.rt.k.nosp@m.oelma.nosp@m.n@me.nosp@m..com)
Since
v1.6.0
See also
pthread::read_write_lock

Definition at line 36 of file read_write_lock.hpp.

Constructor & Destructor Documentation

pthread::read_lock::~read_lock ( )
virtual

the descructor, shall destroy the read-write lock object referenced by rwlock and release any resources used by the lock.

Definition at line 60 of file read_write_lock.cpp.

pthread::read_lock::read_lock ( )
protected

Constructor/Desctructor

this constructor shall allocate any resources required to use the read-write lock referenced by rwlock and initializes the lock to an unlocked state. The read/write lock passes NULL attributes. This means default behavior.

Exceptions
read_write_lock_exceptionif error conditions preventing this method to succeed.

Definition at line 53 of file read_write_lock.cpp.

Member Function Documentation

void pthread::read_lock::lock ( )

The method apply a read lock.

The calling thread acquires the write lock if no other thread (reader or writer) holds the read-write lock. Otherwise, the thread shall block until it can acquire the lock. The calling thread may deadlock if at the time the call is made it holds the read-write lock (whether a read or write lock).

Definition at line 32 of file read_write_lock.cpp.

void pthread::read_lock::try_lock ( )

The method shall apply a read lock, if any thread currently holds the lock (for reading or writing) the method throws an exception.

See also
lock

Definition at line 39 of file read_write_lock.cpp.

void pthread::read_lock::unlock ( )

release the read lock.

Exceptions
read_write_lock_exceptionif error conditions preventing this method to succeed.

Definition at line 46 of file read_write_lock.cpp.

Member Data Documentation

pthread_rwlock_t pthread::read_lock::_rwlock
protected

read/write lock reference

Definition at line 77 of file read_write_lock.hpp.


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