class Lock

Ephemeral mutex or semaphore 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 lockable object on creation and unlocks it on destruction - typically when exiting a block

inline  Lock (Lockable& lck, long maxwait = -1)

Lock

Create the lock, try to lock the object

Parameters:
lckReference to the object to lock
maxwaitTime in microseconds to wait, -1 wait forever

inline  Lock (Lockable* lck, long maxwait = -1)

Lock

Create the lock, try to lock the object

Parameters:
lckPointer to the object to lock
maxwaitTime in microseconds to wait, -1 wait forever

inline  ~Lock ()

~Lock

Destroy the lock, unlock the mutex if it was locked

inline Lockable*  locked ()

locked

[const]

Return a pointer to the lockable object this lock holds

Returns: A pointer to a Lockable or NULL if locking failed

inline void  drop ()

drop

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


Generated by: paulc on bussard on Tue Mar 8 18:42:27 2011, using kdoc 2.0a54.