Lock Class Reference

Ephemeral mutex locking object. More...

#include <yateclass.h>

List of all members.

Public Member Functions

 Lock (Mutex &mutex, long maxwait=-1)
 Lock (Mutex *mutex, long maxwait=-1)
 ~Lock ()
Mutexmutex () const
void drop ()


Detailed Description

Ephemeral mutex locking object.

A lock is a stack allocated (automatic) object that locks a mutex on creation and unlocks it on destruction - typically when exiting a block


Constructor & Destructor Documentation

Lock ( Mutex mutex,
long  maxwait = -1 
) [inline]

Create the lock, try to lock the mutex

Parameters:
mutex Reference to the mutex to lock
maxwait Time in microseconds to wait for the mutex, -1 wait forever

References Mutex::lock().

Lock ( Mutex mutex,
long  maxwait = -1 
) [inline]

Create the lock, try to lock the mutex

Parameters:
mutex Pointer to the mutex to lock
maxwait Time in microseconds to wait for the mutex, -1 wait forever

References Mutex::lock().

~Lock (  )  [inline]

Destroy the lock, unlock the mutex if it was locked

References Mutex::unlock().


Member Function Documentation

Mutex* mutex (  )  const [inline]

Return a pointer to the mutex this lock holds

Returns:
A mutex pointer or NULL if locking failed

void drop (  )  [inline]

Unlock the mutex if it was locked and drop the reference to it


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

Generated on Mon Aug 11 16:17:53 2008 for Yate by  doxygen 1.5.6