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

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

acquire

Attempt to acquire a new lock on another object

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

Returns: True if locking succeeded or same object was locked

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

acquire

Attempt to acquire a new lock on another object

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

Returns: True if locking succeeded or same object was locked


Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.