Files | |
| file | process.h |
| Header file for the Contiki process interface. | |
Defines | |
| #define | PROCESS_BEGIN() |
| Define the beginning of a process. | |
| #define | PROCESS_END() |
| Define the end of a process. | |
| #define | PROCESS_WAIT_EVENT() |
| Wait for an event to be posted to the process. | |
| #define | PROCESS_WAIT_EVENT_UNTIL(c) |
| Wait for an event to be posted to the process, with an extra condition. | |
| #define | PROCESS_YIELD() |
| Yield the currently running process. | |
| #define | PROCESS_YIELD_UNTIL(c) |
| Yield the currently running process until a condition occurs. | |
| #define | PROCESS_WAIT_UNTIL(c) |
| Wait for a condition to occur. | |
| #define | PROCESS_EXIT() |
| Exit the currently running process. | |
| #define | PROCESS_SPAWN(pt, thread) |
| Spawn a protothread from the process. | |
| #define | PROCESS_PAUSE() |
| Yield the process for a short while. | |
| #define | PROCESS_THREAD(name, ev, data) |
| Define the body of a process. | |
| #define | PROCESS_NAME(name) |
| Declare the name of a process. | |
| #define | PROCESS(name, strname) |
| Declare a process. | |
| #define | PROCESS_CURRENT() |
| Get a pointer to the currently running process. | |
Functions | |
| int | process_post (struct process *p, process_event_t ev, process_data_t data) |
| Post an asynchronous event. | |
| int | process_run (void) |
| Process one event from the event queue. | |
|
|
Declare a process. This macro declares a process with the variable name of the process, and a textual repressentation of the process (used mainly for debugging).
|
|
|
Define the beginning of a process. This macro defines the beginning of a process, and must always appear in a PROCESS_THREAD() definition. The PROCESS_END() macro must come at the end of the process.
|
|
|
Get a pointer to the currently running process. This macro get a pointer to the currently running process. Typically, this macro is used to post an event to the current process with process_post(). |
|
|
Define the end of a process. This macro defines the end of a process. It must appear in a PROCESS_THREAD() definition and must always be included. The process exits when the PROCESS_END() macro is reached.
|
|
|
Declare the name of a process. This macro is typically used in header files to declare the name of a process that is implemented in the C file. |
|
|
Yield the process for a short while. This macro yields the currently running process for a short while, thus letting other processes run before the process continues. |
|
|
Spawn a protothread from the process.
|
|
|
Value: static PT_THREAD(process_thread_##name(struct pt *process_pt, \ process_event_t ev, \ process_data_t data)) This macro is used to define the body (protothread) of a process. The process is called whenever an event occurs in the system, A process always start with the PROCESS_BEGIN() macro and end with the PROCESS_END() macro.
|
|
|
Wait for an event to be posted to the process. This macro blocks the currently running process until the process receives an event. |
|
|
Wait for an event to be posted to the process, with an extra condition. This macro is similar to PROCESS_WAIT_EVENT() in that it blocks the currently running process until the process receives an event. But PROCESS_WAIT_EVENT_UNTIL() takes an extra condition which must be true for the process to continue.
|
|
|
Wait for a condition to occur. This macro does not guarantee that the process yields, and should therefore be used with care. In most cases, PROCESS_WAIT_EVENT(), PROCESS_WAIT_EVENT_UNTIL(), PROCESS_YIELD() or PROCESS_YIELD_UNTIL() should be used instead.
|
|
|
Yield the currently running process until a condition occurs. This macro is different from PROCESS_WAIT_UNTIL() in that PROCESS_YIELD_UNTIL() is guaranteed to always yield at least once. This ensures that the process does not end up in an infinite loop and monopolizing the CPU.
|
|
||||||||||||||||
|
Post an asynchronous event. This function posts an asynchronous event to one or more processes. The handing of the event is deferred until the target process is scheduled by the kernel. An event can be broadcast to all processes, in which case all processes in the system will be scheduled to handle the event.
|
|
|
Process one event from the event queue. This function should be called repeatedly from the main() program to actuall run the Contiki system. It calls the necessary poll handlers, and processes one event. The function returns the number of events that are waiting in the event queue so that the caller may choose to put the CPU to sleep when there are no pending events.
|
1.3.6