Inherits 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) | |
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.
|
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().
|
inline |
|
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().
|
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.
©2019 The Foundry Visionmongers, Ltd. All Rights Reserved. |