Class Dispatcher

Class Dispatcher

Placement in the overall structure

Module
thread
Base classes
None
Derived classes
Scheduler
Time of creation
Task 4
Files
dispatch.h dispatch.cc

Description

The dispatcher manages the life pointer, which indicates the currently active coroutine, and performs process switches.

Public methods

Dispatcher ()
The constructor initializes the life pointer with null to indicate that no coroutine is known yet.
void go (Coroutine& first)
With this method the coroutine first is put in the life pointer and started.
void dispatch (Coroutine& next)
This method sets the life pointer to next and performs a coroutine switch from the old to the new life pointer.
Coroutine* active ()
This can be used to determine which coroutine is currently in control of the processor.