ROOT » CORE » BASE » TLockGuard

class TLockGuard


TVirtualMutex

This class implements a mutex interface. The actual work is done via
TMutex which is available as soon as the thread library is loaded.

and

TLockGuard

This class provides mutex resource management in a guaranteed and
exception safe way. Use like this:
{
TLockGuard guard(mutex);
... // do something
}
when guard goes out of scope the mutex is unlocked in the TLockGuard
destructor. The exception mechanism takes care of calling the dtors
of local objects so it is exception safe.


Function Members (Methods)

public:
~TLockGuard()
static TClass*Class()
TClass*IsA() const
voidShowMembers(TMemberInspector& insp) const
voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
TLockGuard(TVirtualMutex* mutex)
Int_tUnLock()

Data Members

private:
TVirtualMutex*fMutex

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

Int_t UnLock()
TLockGuard(const TLockGuard& )
TLockGuard& operator=(const TLockGuard& )
TLockGuard(TVirtualMutex* mutex)
{ if (fMutex) fMutex->Lock(); }
~TLockGuard()
{ if (fMutex) fMutex->UnLock(); }