Rewrote the process code so that initialization events are posted synchronously instead of asynchronously, so that we don't have to explicitly wait for processes to be initialized. This also reduces the size of the event queue by half on the Tmote Sky platform since the queue was maximized during system bootup. This change also prompted an update of the process invokation code to ensure that a process is not invoked again when processing an event. General cleanup of the code also.
This commit is contained in:
parent
c8dccbbd40
commit
f4dd9ccd5b
2 changed files with 79 additions and 99 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: process.h,v 1.12 2007/11/17 22:11:19 adamdunkels Exp $
|
||||
* @(#)$Id: process.h,v 1.13 2008/01/23 15:18:06 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -275,7 +275,6 @@ typedef unsigned char process_num_events_t;
|
|||
static PT_THREAD(process_thread_##name(struct pt *process_pt, \
|
||||
process_event_t ev, \
|
||||
process_data_t data))
|
||||
|
||||
#if PROCESS_LOADABLE
|
||||
#define PROCESS_LOAD(name) const struct process *process_load = &name
|
||||
#else /* PROCESS_LOADABLE */
|
||||
|
@ -320,7 +319,7 @@ struct process {
|
|||
const char *name;
|
||||
PT_THREAD((* thread)(struct pt *, process_event_t, process_data_t));
|
||||
struct pt pt;
|
||||
unsigned char state;
|
||||
unsigned char state, needspoll;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -337,7 +336,7 @@ struct process {
|
|||
* process
|
||||
*
|
||||
*/
|
||||
void process_start(struct process *p, char *arg);
|
||||
void process_start(struct process *p, const char *arg);
|
||||
|
||||
/**
|
||||
* Post an asynchronous event.
|
||||
|
@ -497,6 +496,18 @@ void process_init(void);
|
|||
*/
|
||||
int process_run(void);
|
||||
|
||||
|
||||
/**
|
||||
* Check if a process is running.
|
||||
*
|
||||
* This function checks if a specific process is running.
|
||||
*
|
||||
* \param p The process.
|
||||
* \retval Non-zero if the process is running.
|
||||
* \retval Zero if the process is not running.
|
||||
*/
|
||||
int process_is_running(struct process *p);
|
||||
|
||||
/**
|
||||
* Number of events waiting to be processed.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue