![]() |
VR-Forces Developer's Guide
|
If you need access to data in the main thread outside of the advance frame, use this lock (with the lock flag as true) to prevent the advancing of the frame in the network thread. Note that if the network thread is in the middile of advancing the frame when this lock is attemped to be used, then, the thread will hang until the lock is available.
Public Member Functions | |
| DtGateLock () | |
| virtual | ~DtGateLock () |
| bool | wait (std::chrono::milliseconds timeout) |
| void | allowAdvance () |
| void | disallowAdvance () |
| bool | lock (double timeout=-1) |
| void | unlock () |
Static Public Attributes | |
| static boost::signals2::signal < void()> | signal_gateLocked |
| static boost::signals2::signal < void()> | signal_gateUnlocked |
Protected Attributes | |
| tbb::mutex::scoped_lock | myLock |
| bool | myLocked = false |
| makVrf::DtGateLock::DtGateLock | ( | ) |
If lock is true will try and lock the mutex to allow for exclusive access to the gate. If try is true will try to get the lock. If the lock cannot be retrieved then isLocked is false and you know the data access is not safe.
|
virtual |
| bool makVrf::DtGateLock::wait | ( | std::chrono::milliseconds | timeout | ) |
Wait for the condition to trigger from another thread based on the amount of time. Will return true if condition is met or false if the timeout is reached.
| void makVrf::DtGateLock::allowAdvance | ( | ) |
Notify that the condition has been met.
| void makVrf::DtGateLock::disallowAdvance | ( | ) |
Reset condition so it cannot be met.
If timeout is -1 means wait forever. Timeout is in seconds.
| void makVrf::DtGateLock::unlock | ( | ) |
|
static |
|
static |
|
protected |
|
protected |