Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Examples

Multi-threading library convenience functions
[Multi-threading library]


Detailed Description

The Contiki multi-threading library has an interface that might be hard to use.

Therefore, the mtp module provides a simpler interface.

Example:

static void
example_thread_code(void *data)
{
  while(1) {
    printf("Test\n");
    mt_yield();
  }
}
MTP(example_thread, "Example thread", p1, t1, t1_idle);

int
main(int argc, char *argv[])
{
  mtp_start(&example_thread, example_thread_code, NULL);
}


Data Structures

struct  mt_process

Defines

#define MT_PROCESS(name, strname)
 Declare a multithreaded process.

Functions

void mtp_start (struct mt_process *p, void(*function)(void *), void *data)
 Start a thread.
void mtp_exit (void)


Define Documentation

#define MT_PROCESS name,
strname   ) 
 

Declare a multithreaded process.

This macro is used to declare a multithreaded process.

Definition at line 332 of file mt.h.


Function Documentation

void mtp_start struct mt_process p,
void(*)(void *)  function,
void *  data
 

Start a thread.

This function starts the process in which the thread is to run, and also sets up the thread to run within the process. The function should be passed variable names declared with the MTP() macro.

Parameters:
t A pointer to a thread structure previously declared with MTP().
function A pointer to the function that the thread should start executing.
data A pointer that the function should be passed when first invocated.

Definition at line 170 of file mt.c.

References mt_start(), mt_process::p, process_start(), and mt_process::t.


Generated on Thu Jun 22 17:45:43 2006 for Contiki 2.x by  doxygen 1.4.4