class Lock

Ephemeral mutex locking object. More...

Full nameTelEngine::Lock
Definition#include <yateclass.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

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

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

Lock

Create the lock, try to lock the mutex

Parameters:
mutexReference to the mutex to lock
maxwaitTime in microseconds to wait for the mutex, -1 wait forever

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

Lock

Create the lock, try to lock the mutex

Parameters:
mutexPointer to the mutex to lock
maxwaitTime in microseconds to wait for the mutex, -1 wait forever

inline  ~Lock ()

~Lock

Destroy the lock, unlock the mutex if it was locked

inline Mutex*  mutex ()

mutex

[const]

Return a pointer to the mutex this lock holds

Returns: A mutex pointer or NULL if locking failed

inline void  drop ()

drop

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


Generated by: root on dragoshel on Sat Apr 14 01:50:50 2007, using kdoc 2.0a54.