diff options
| author | Keith Packard <keithp@keithp.com> | 2010-04-06 00:56:57 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2010-04-06 00:56:57 -0700 | 
| commit | 9e10e43eff9de3f034da49c4f88728fb933f5035 (patch) | |
| tree | 310f13bb8715783a155bbea772c48d2f749fec15 /src/ao_task.c | |
| parent | a7fc7901cd591c93d9d0cffeec2977ebb17554d4 (diff) | |
Tasks may move in task structure as a result of ao_exit
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_task.c')
| -rw-r--r-- | src/ao_task.c | 11 | 
1 files changed, 10 insertions, 1 deletions
| diff --git a/src/ao_task.c b/src/ao_task.c index 4a78766e..72c9d7d6 100644 --- a/src/ao_task.c +++ b/src/ao_task.c @@ -28,10 +28,19 @@ void  ao_add_task(__xdata struct ao_task * task, void (*start)(void), __code char *name) __reentrant  {  	uint8_t	__xdata *stack; +	uint8_t task_id; +	uint8_t t;  	if (ao_num_tasks == AO_NUM_TASKS)  		ao_panic(AO_PANIC_NO_TASK); +	for (task_id = 1; task_id != 0; task_id++) { +		for (t = 0; t < ao_num_tasks; t++) +			if (ao_tasks[t]->task_id == task_id) +				break; +		if (t == ao_num_tasks) +			break; +	}  	ao_tasks[ao_num_tasks++] = task; -	task->task_id = ao_num_tasks; +	task->task_id = task_id;  	task->name = name;  	/*  	 * Construct a stack frame so that it will 'return' | 
