Public Member Functions | List of all members
Celartem::ReaderWriterLock Class Reference

#include <cel_rwlock.h>

Public Member Functions

 ReaderWriterLock ()
 
 ~ReaderWriterLock ()
 
void lockForRead ()
 
void lockForWrite ()
 
void unlock ()
 

Detailed Description

This class implements typical Reader-Writer lock. The Reader-Writer lock is used in the situation which meets the following conditions:


You can use this class as auto variable like the following code:

SomeSharedObject g_something; // some shared object
void writeFunc()
{
WriterLock lock(g_rwlock);
// write access
g_something.do_something_like_write(...);
}
void readFunc()
{
ReaderLock lock(g_rwlock);
// read-only access
g_something.do_something_like_read(...);
}

Constructor & Destructor Documentation

Celartem::ReaderWriterLock::ReaderWriterLock ( )
inline

Initializes the instance.

Celartem::ReaderWriterLock::~ReaderWriterLock ( )
inline

Uninitialize the instance.

Member Function Documentation

void Celartem::ReaderWriterLock::lockForRead ( )
inline
void Celartem::ReaderWriterLock::lockForWrite ( )
inline
void Celartem::ReaderWriterLock::unlock ( )
inline

Unlock the last lock (either of read or write).

Referenced by Celartem::RWLock::unlock(), and Celartem::ReaderWriterLockLockerTempl< isWriter >::unlock().


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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo