Nuke binary plugins  14.0.8
DD::Image::SignalLock Class Reference
Inheritance diagram for DD::Image::SignalLock:
DD::Image::Lock

Public Member Functions

void signal ()
 
void signal_one ()
 
bool wait (unsigned long timeoutms=0)
 
void spinsignal ()
 
void spinwait ()
 
- 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 class combines a lock with a pthreads condition. This allows one thread to wait until another thread has modified the data that is protected by the lock.

Member Function Documentation

DD::Image::SignalLock::signal ( )
inline

You must lock() the SignalLock before calling this! This will send a signal to any other threads that are currently inside of wait(). Note that those threads will not get out of wait() until this thread does unlock().

Referenced by DD::Image::FileReader::unlock().

DD::Image::SignalLock::signal_one ( )
inline

Same as signal() except you know that at most only one thread has called wait(). If more than one has called wait() then only one of them will return.

DD::Image::SignalLock::wait ( unsigned long  timeoutms = 0)
inline

You must lock() the SignalLock exactly once before calling this! This unlocks the lock, then waits for another thread to call signal(). This then calls lock() and returns.

If timeoutms is specified it will wait up to timeoutms milliseconds before returning. It will return true if the thread is signalled and return false if the timeout occurred. A timeoutms of 0 ( the default ) means wait indefinitely.

Note: On windows this may also return even if signal() is not called. You should always check the data protected by the lock to make sure it is correct, if not you should run wait() again.

Referenced by DD::Image::FileReader::lock().

DD::Image::SignalLock::spinsignal ( )
inline

Same as signal(), this can be used if you know the other thread is doing spinwait(). On all platforms currently this is a no-op.

DD::Image::SignalLock::spinwait ( )
inline

Same as wait() but it executes by spinning in a loop in this thread. This is faster if you expect the other thread to signal very soon and for it to then quickly unlock().



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com