DD::Image::RecursiveLock Class Reference

Inherits DD::Image::Lock.

Public Member Functions

void lock ()
 
void spinlock ()
 
bool trylock ()
 
void unlock ()
 
- Public Member Functions inherited from DD::Image::Lock
 Lock ()
 
pthread_mutex_t & get_mutex ()
 
void lock ()
 
void spinlock ()
 
void unlock ()
 
bool trylock ()
 
void spinsignal ()
 
void spinwait ()
 
virtual ~Lock ()
 

Additional Inherited Members

- Protected Member Functions inherited from DD::Image::Lock
 Lock (const pthread_mutexattr_t *a)
 

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.

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.

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

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



©2020 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk