The dispatcher dispatches threads and, by that, puts the scheduler's decisions into action.
More...
#include <thread/dispatcher.h>
|
static Thread * | active () |
| Returns the co-routing currently running on the CPU calling active() More...
|
|
static bool | isActive (const Thread *thread, unsigned *cpu=nullptr) |
| Check if thread is currently active. More...
|
|
static void | go (Thread *first) |
| This method stores first as life pointer for this CPU and triggers the execution of first. More...
|
|
static void | dispatch (Thread *next) |
| Updates the life pointer to next and issues a co-routine change from the old to the new life pointer. More...
|
|
The dispatcher dispatches threads and, by that, puts the scheduler's decisions into action.
- Note
- The dispatcher manages the life pointer that refers to the currently active coroutine and performs the actual switching of processes. For single-core systems, a single life pointer is sufficient, as only a single process can be active at one point in time. On multi-core systems, every CPU needs its own life pointer.
◆ active()
static Thread* Dispatcher::active |
( |
| ) |
|
|
inlinestatic |
Returns the co-routing currently running on the CPU calling active()
◆ isActive()
static bool Dispatcher::isActive |
( |
const Thread * |
thread, |
|
|
unsigned * |
cpu = nullptr |
|
) |
| |
|
inlinestatic |
Check if thread is currently active.
- Parameters
-
thread | Pointer to the thread in question |
cpu | will receive the core number if cpu pointer is not nullptr and the thread is currently active |
- Returns
true
if currently running, false otherwise
◆ go()
void Dispatcher::go |
( |
Thread * |
first | ) |
|
|
static |
This method stores first as life pointer for this CPU and triggers the execution of first.
- Parameters
-
first | First co-routine to be executed on this CPU. |
◆ dispatch()
void Dispatcher::dispatch |
( |
Thread * |
next | ) |
|
|
static |
Updates the life pointer to next and issues a co-routine change from the old to the new life pointer.
- Parameters
-
next | Next co-routine to be executed. |
The documentation for this class was generated from the following files: