Home
About Contiki
Download
Instant Contiki
Install and Compile
Documentation
Publications and Talks
Contiki Projects
Mailing lists
Changelog
uIPv6 FAQ
Statistics
Visitors: 1687202
Article Categories
Current Events
Developers
Events
News
Perspective
Platforms
Projects
Tutorials
All
User Menu
Profile
Login
Syndicate
Using Multi-Threading in Contiki Print
Written by Adam Dunkels, Tuesday, 23 January 2007

Image

Unlike other embedded operating systems, Contiki supports both an event-driven execution model and multi-threading. (And protothreads, of course.) Using multi-threading in Contiki is easy, but it requires you to be explicit about it: read on for the details.

The principle behind the Contiki multi-threading library is simple: create a thread with the mt_start() function and call mt_exec() to schedule the thread. After a call to mt_exec() the thread will run until the thread calls mt_yield() or mt_exit(). The thread is represented by a variable of type struct mt_thread. This structure contains the full state of the thread, including the thread’s stack.

Scheduling the thread typically is done in a Contiki process. By repeatedly posting continuation events to itself, the process can schedule the thread so that it runs continuously.

See the Contiki documentation for more information: http://www.sics.se/~adam/contiki/docs/

 
< Prev   Next >

Adam Dunkels (contact)