DD::Image::RecursiveLock Class Reference

Inherits DD::Image::Lock.

List of all members.

Public Member Functions

void lock ()
void spinlock ()
bool trylock ()
void unlock ()

Detailed Description

This is the same as a Lock except a thread can call lock() several times (all subsequent calls return immediatly) and must call unlock() the same number of times before another thread calling lock() will return.


Member Function Documentation

void DD::Image::RecursiveLock::lock ( ) [inline]

When this returns, the calling thread will "own" the lock.

If no thread owns the lock this will return immediately.

If another thread owns the lock this will block (not return) until that other thread calls unlock().

If this thread already owns the lock, this returns immediately, but an internal counter is incremented so that unlock() must be called the same number of times.

Reimplemented from DD::Image::Lock.

References DD::Image::Lock::lock().

Referenced by DD::Image::OpTreeHandler::lockTrees().

void DD::Image::RecursiveLock::unlock ( ) [inline]

Release the lock. If lock() was called more than once, this decrementes the lock counter. Once this goes to zero the lock is really unlocked and another thread's call to lock() can return.

Reimplemented from DD::Image::Lock.

References DD::Image::Lock::unlock().

Referenced by DD::Image::OpTreeHandler::unlockTrees().