![]() |
RobWorkProject
23.9.11-
|
A thread safe protected variable. More...
#include <ThreadSafeVariable.hpp>
Public Member Functions | |
| ThreadSafeVariable (const T var) | |
| Create new protected variable. More... | |
| virtual | ~ThreadSafeVariable () |
| Destructor. | |
| T | getVariable () |
| Get the value. More... | |
| void | setVariable (const T var) |
| Change the value. More... | |
| T | waitForUpdate (T previous) |
| Wait for a change of the value (blocking). More... | |
| T | operator() () |
| Use the () operator to access the value. More... | |
| void | operator= (const T var) |
| Set the value using the assignment operator (same as using setVariable()). More... | |
A thread safe protected variable.
This is very useful for making simple thread-safe variables, but also for synchronization between threads.
|
inline |
Create new protected variable.
| var | [in] the initial value. |
|
inline |
Get the value.
|
inline |
Use the () operator to access the value.
|
inline |
Set the value using the assignment operator (same as using setVariable()).
| var | [in] the new value. |
|
inline |
Change the value.
| var | [in] the new value. |
|
inline |
Wait for a change of the value (blocking).
| previous | [in] the previous value to compare with. |