The Thread is an object used by the scheduler.
More...
#include <thread.h>
|
| | Thread (void *tos) |
| | Constructor Initializes the context using prepareContext with the given stack space.
|
| |
| void | go () |
| | Activates the first thread on this CPU.
|
| |
| void | resume (Thread *next) |
| | Switches from the currently running thread to the next one.
|
| |
| virtual void | action ()=0 |
| | Method that contains the thread's program code.
|
| |
|
|
volatile bool | kill_flag |
| | Marker for a dying thread.
|
| |
|
|
Context | context |
| | Context of the thread, used for saving and restoring the register values when context switching.
|
| |
|
|
Thread * | queue_link |
| | pointer to the next element of the readylist
|
| |
|
|
class | Queue< Thread > |
| |
|
class | Semaphore |
| |
The Thread is an object used by the scheduler.
◆ Thread()
| Thread::Thread |
( |
void * | tos | ) |
|
|
explicit |
Constructor Initializes the context using prepareContext with the given stack space.
- Parameters
-
| tos | the top of stack, highest address of some memory block that should be used as stack (remember stacks grow to the lower addresses on x86). |
◆ action()
Method that contains the thread's program code.
Derived classes are meant to override this method to provide meaningful code to be run in this thread.
Implemented in Application, IdleThread, and KeyboardApplication.
◆ go()
Activates the first thread on this CPU.
Calling the method starts the first thread on the calling CPU. From then on, Thread::resume() must be used for all subsequent context switches.
◆ kickoff()
| void Thread::kickoff |
( |
Thread * | object | ) |
|
|
staticprotected |
The thread's entry point.
For the first activation of a thread, we need a "return address" pointing to a function that will take care of calling C++ virtual methods (e.g. action()), based on the thread object pointer. For this purpose, we use this kickoff() function.
- Note
- As this function is never actually called, but only executed by returning from the co-routine's initial stack, it may never return. Otherwise garbage values from the stack will be interpreted as return address and the system might crash.
- Parameters
-
◆ resume()
| void Thread::resume |
( |
Thread * | next | ) |
|
Switches from the currently running thread to the next one.
The values currently present in the callee-saved registers will be stored in this threads context-structure, the corresponding values belonging to next thread will be loaded.
- Parameters
-
| next | Pointer to the next thread. |
The documentation for this class was generated from the following files: