Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ThreadNS::Lock Class Reference

#include <Thread.h>

Inheritance diagram for ThreadNS::Lock:

List of all members.


Detailed Description

an inter-thread lock -- doesn't work across processes, only threads within a process. (see MutexLock for inter-process locks)

Definition at line 17 of file Thread.h.


Public Member Functions

 Lock ()
 constructor
 ~Lock ()
 destructor -- dereference and release (if any references remain)
void lock ()
 block until lock is obtained
bool trylock ()
 see if lock is available
void unlock ()
 release lock, if held
unsigned int getInstanceLockLevel () const
 returns the lock level of the local instance of Lock (as opposed to the lock storage structure, which might be shared with other Lock instances)
unsigned int getLockLevel () const
 returns the lock level of the lock storage itself, the sum of all instance's lock levels

Protected Member Functions

virtual void useResource (Resource::Data &)
 marks the resource as in use
virtual void releaseResource (Resource::Data &)
 releases the resource

Static Protected Member Functions

static void setup ()
 creates a new glock if it is currently NULL (should be called by the Lock() constructor)

Protected Attributes

LockStorage * mylock
 This lock's implementation.
unsigned int locklevel
 the current lock level from this Lock, may differ from mylock's lock level if several Locks are sharing a storage!

Static Protected Attributes

static LockStorage * glock
 this internal class will hold the system-dependent lock information

Private Member Functions

 Lock (const Lock &l)
 don't call
Lockoperator= (const Lock &l)
 don't call

Friends

class MarkScope
class Condition

Constructor & Destructor Documentation

ThreadNS::Lock::Lock (  ) 

constructor

Definition at line 423 of file Thread.cc.

ThreadNS::Lock::~Lock (  ) 

destructor -- dereference and release (if any references remain)

Definition at line 457 of file Thread.cc.

ThreadNS::Lock::Lock ( const Lock l  )  [private]

don't call


Member Function Documentation

void ThreadNS::Lock::lock (  ) 

block until lock is obtained

Definition at line 467 of file Thread.cc.

Referenced by useResource().

bool ThreadNS::Lock::trylock (  ) 

see if lock is available

Definition at line 471 of file Thread.cc.

void ThreadNS::Lock::unlock (  ) 

release lock, if held

Definition at line 479 of file Thread.cc.

Referenced by releaseResource(), and ~Lock().

unsigned int ThreadNS::Lock::getInstanceLockLevel (  )  const [inline]

returns the lock level of the local instance of Lock (as opposed to the lock storage structure, which might be shared with other Lock instances)

Definition at line 27 of file Thread.h.

unsigned int ThreadNS::Lock::getLockLevel (  )  const

returns the lock level of the lock storage itself, the sum of all instance's lock levels

Definition at line 483 of file Thread.cc.

virtual void ThreadNS::Lock::useResource ( Resource::Data d  )  [inline, protected, virtual]

marks the resource as in use

Implements Resource.

Definition at line 32 of file Thread.h.

virtual void ThreadNS::Lock::releaseResource ( Resource::Data d  )  [inline, protected, virtual]

releases the resource

Implements Resource.

Definition at line 33 of file Thread.h.

void ThreadNS::Lock::setup (  )  [static, protected]

creates a new glock if it is currently NULL (should be called by the Lock() constructor)

Definition at line 486 of file Thread.cc.

Referenced by Lock().

Lock& ThreadNS::Lock::operator= ( const Lock l  )  [private]

don't call


Friends And Related Function Documentation

friend class MarkScope [friend]

Definition at line 30 of file Thread.h.

friend class Condition [friend]

Definition at line 31 of file Thread.h.


Member Data Documentation

LockStorage* ThreadNS::Lock::glock [static, protected]

this internal class will hold the system-dependent lock information

The global lock to protect Locks sharing mylock's

Definition at line 35 of file Thread.h.

Referenced by Lock(), setup(), and ~Lock().

LockStorage* ThreadNS::Lock::mylock [protected]

This lock's implementation.

Definition at line 37 of file Thread.h.

Referenced by getLockLevel(), lock(), ThreadNS::Condition::timedwait(), trylock(), unlock(), ThreadNS::Condition::wait(), and ~Lock().

unsigned int ThreadNS::Lock::locklevel [protected]

the current lock level from this Lock, may differ from mylock's lock level if several Locks are sharing a storage!

Definition at line 39 of file Thread.h.

Referenced by getInstanceLockLevel(), lock(), trylock(), unlock(), and ~Lock().


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

Tekkotsu v4.0
Generated Thu Nov 22 00:58:59 2007 by Doxygen 1.5.4