Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Thread::Lock Class Reference

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

#include <Thread.h>

Inheritance diagram for Thread::Lock:

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 43 of file Thread.h.

List of all members.

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

Thread::Lock::Lock (  ) 

constructor

Definition at line 592 of file Thread.cc.

Thread::Lock::~Lock (  ) 

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

Definition at line 626 of file Thread.cc.

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

don't call


Member Function Documentation

unsigned int Thread::Lock::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)

Definition at line 53 of file Thread.h.

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

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

Definition at line 658 of file Thread.cc.

Referenced by MutexLock< MAX_ACCESS >::get_lock_level(), MutexLock< MAX_ACCESS >::releaseAll(), Thread::Condition::timedwait(), MutexLock< MAX_ACCESS >::unlock(), Thread::Condition::wait(), and MutexLock< MAX_ACCESS >::~MutexLock().

void Thread::Lock::lock (  ) 

block until lock is obtained

Definition at line 50 of file Thread.h.

Referenced by MutexLock< MAX_ACCESS >::lock(), and Thread::~Thread().

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

don't call

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

releases the resource

Implements Resource.

Definition at line 654 of file Thread.cc.

Referenced by unlock().

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

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

Definition at line 661 of file Thread.cc.

Referenced by Lock().

bool Thread::Lock::trylock (  ) 

see if lock is available

Definition at line 644 of file Thread.cc.

Referenced by MutexLock< MAX_ACCESS >::try_lock().

void Thread::Lock::unlock (  ) 
void Thread::Lock::useResource ( Resource::Data d  )  [protected, virtual]

marks the resource as in use

Implements Resource.

Definition at line 640 of file Thread.cc.

Referenced by lock().


Friends And Related Function Documentation

friend class Condition [friend]

Definition at line 57 of file Thread.h.

friend class MarkScope [friend]

Definition at line 56 of file Thread.h.


Member Data Documentation

LockStorage* Thread::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 61 of file Thread.h.

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

unsigned int Thread::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 65 of file Thread.h.

Referenced by getInstanceLockLevel(), releaseResource(), trylock(), useResource(), and ~Lock().

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

This lock's implementation.

Definition at line 63 of file Thread.h.

Referenced by getLockLevel(), releaseResource(), Thread::Condition::timedwait(), trylock(), useResource(), Thread::Condition::wait(), and ~Lock().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:17 2016 by Doxygen 1.6.3