framexmit::semlock Class Reference
[Frame multicast client/server]

#include <fxmitmutex.hh>

List of all members.

Public Types

enum  locktype { rdlock = 0, wrlock = 1 }
 type of lock More...

Public Member Functions

 semlock (abstractsemaphore &sem)
 semlock (abstractsemaphore &sem, locktype lck)
virtual ~semlock ()


Detailed Description

This class can be used to automatically lock and unlock a semaphore over the duration of a function call. semlock has to be initialized with an mutex, a recursive mutex or a read/write lock. Upon contruction of the object the semaphore is locked. When the object is destroyed the semaphore is automatically freed.

{verbatim} Example:

mutex mux; void foobar () { mutexlock lockit (mux); statements of foobar here } {verbatim}

Since an object is automatically destroyed at the end of its context, semlock can also be used in loops and branches of conditional statments, or in any compound statement to protect a resource for the duration of the context.

brief Class to automatically lock and unlock a mutex.

Author:
DS, November 98
See also:
Recursive mutex objects

Member Enumeration Documentation

enum framexmit::semlock::locktype

type of lock

Enumerator:
rdlock  read lock
wrlock  write lock


Constructor & Destructor Documentation

framexmit::semlock::semlock ( abstractsemaphore sem  )  [inline, explicit]

Constructs a semmutex object and locks the semaphore. brief Default constructor.

Parameters:
sem reference to a semaphore to be locked
Returns:
void

framexmit::semlock::semlock ( abstractsemaphore sem,
locktype  lck 
) [inline]

Constructs a semmutex object and locks the semaphore. The second argument specifies whether a read or write lock is applied. brief Default constructor.

Parameters:
sem reference to a semaphore to be locked
lck Lock type.
Returns:
void

virtual framexmit::semlock::~semlock (  )  [virtual]

Destructs the semmutex object and unlocks the semaphore. brief Default destructor.

Returns:
void


The documentation for this class was generated from the following file:
Generated on Sun Mar 8 19:21:24 2009 for dmt by  doxygen 1.5.4