Contiki 2.6
|
The event driven Contiki kernel does not provide multi-threading by itself - instead, preemptive multi-threading is implemented as a library that optionally can be linked with applications. More...
Modules | |
Architecture support for multi-threading | |
The Contiki multi-threading library requires some architecture specific support for setting up and switching stacks. | |
Defines | |
#define | MT_OK 1 |
No error. | |
Functions | |
void | mt_init (void) |
Initializes the multithreading library. | |
void | mt_remove (void) |
Uninstalls library and cleans up. | |
void | mt_start (struct mt_thread *thread, void(*function)(void *), void *data) |
Starts a multithreading thread. | |
void | mt_exec (struct mt_thread *thread) |
Execute parts of a thread. | |
void | mt_yield (void) |
Voluntarily give up the processor. | |
void | mt_exit (void) |
Exit a thread. | |
void | mt_stop (struct mt_thread *thread) |
Stop a thread. |
The event driven Contiki kernel does not provide multi-threading by itself - instead, preemptive multi-threading is implemented as a library that optionally can be linked with applications.
This library consists of two parts: a platform independent part, which is the same for all platforms on which Contiki runs, and a platform specific part, which must be implemented specifically for the platform that the multi-threading library should run.
void mt_exec | ( | struct mt_thread * | thread | ) |
Execute parts of a thread.
This function is called by a Contiki process and runs a thread. The function does not return until the thread has yielded, or is preempted.
thread | A pointer to a struct mt_thread block that must be allocated by the caller. |
Definition at line 80 of file mt.c.
References mtarch_exec().
Referenced by main().
void mt_exit | ( | void | ) |
Exit a thread.
This function is called from within an executing thread in order to exit the thread. The function never returns.
Definition at line 106 of file mt.c.
References mtarch_yield(), and NULL.
void mt_start | ( | struct mt_thread * | thread, |
void(*)(void *) | function, | ||
void * | data | ||
) |
Starts a multithreading thread.
thread | Pointer to an mt_thread struct that must have been previously allocated by the caller. |
function | A pointer to the entry function of the thread that is to be set up. |
data | A pointer that will be passed to the entry function. |
Definition at line 70 of file mt.c.
References mtarch_start().
Referenced by main().
void mt_stop | ( | struct mt_thread * | thread | ) |
Stop a thread.
This function is called by a Contiki process in order to clean up a thread. The struct mt_thread block may then be discarded by the caller.
thread | A pointer to a struct mt_thread block that must be allocated by the caller. |
Definition at line 114 of file mt.c.
References mtarch_stop().
void mt_yield | ( | void | ) |
Voluntarily give up the processor.
This function is called by a running thread in order to give up control of the CPU.
Definition at line 92 of file mt.c.
References mtarch_yield(), and NULL.