Module riot_wrappers::thread

source ·
Expand description

Create, inspect or modify RIOT processes (“threads”)


Some thread creation mechanisms (currently only riot_main_with_tokens and not those in here) are “with tokens”. With these, the zero-sized type StartToken is used to pass along the information that the execution is currently happening in a thread, and more importantly that some operations doable only once per thread (eg. setting up a message queue) have not yet happed.

When threads are created that way, they need to return a TerminationToken which ensures that no operations that preclude the termination of a thread have happened.

This has multiple implementations:

  • one wrapping the RIOT (C) core/ API

The right implementation is selected with help from the build system, similar to how std’s platform dependent backends are selected.


Lifetimed helper through which threads can be spawned.
Zero-size statement that the current code is running in an interrupt
Zero-size statement that the current code is not running in an interrupt
Wrapper around a valid (not necessarily running, but in-range) riot_sys::kernel_pid_t that provides access to thread details and signaling.
Error returned by PID methods when no thread with that PID exists
Gathered information about a thread, returned by [KernelPID::stack_stats()].
Data necessary to return from a thread that has received the StartToken permissions.
A StartToken that has possibly already lost some of its properties.
A value combined with an InThread marker



PID of the currently active thread
Create a context for starting threads that take shorter than ’static references.
Put the current thread in the “sleeping” state, only to be continue when something calls KernelPID::wakeup() on its PID.
Create a thread with a statically allocated stack

Type Definitions

Data created for each thread that is spawned.