|
|
Provide the thread with basic functionalities. More...
#include <DeterministicThread.h>
Public Member Functions | |
| template<typename BasicLockable , typename... Args> | |
| void | lock (BasicLockable *lockable, Args &&... args) |
Lock lockable and update the current thread_status_v of the current deterministic thread. | |
| template<typename BasicLockable , typename... Args> | |
| void | lock_shared (BasicLockable *lockable, Args &&... args) |
Lock lockable in shared mode and update the current thread_status_v of the current deterministic thread. | |
| void | switchContext () |
| Notify the scheduler that this thread is ready to give it back the control and wait until the scheduler notify back. | |
Provide the thread with basic functionalities.
Use case of thread_context:
lock(&m) lock the thread_context on the m mutex;switchContext() switch the context back to the scheduler;unlock() unlock the m mutex.
|
inline |
Lock lockable and update the current thread_status_v of the current deterministic thread.
| lockable | : a lockable object like a mutex. |
| args | : arguments that will be forwarded to the .lock(). |
Example of lock():
|
inline |
Lock lockable in shared mode and update the current thread_status_v of the current deterministic thread.
| lockable | : a lockable object like a mutex. |
| args | : arguments that will be forwarded to the .lock_shared(). |
Example of lock_shared():
|
inline |
Notify the scheduler that this thread is ready to give it back the control and wait until the scheduler notify back.
Example of switchContext():