Re: Multi-Tasking Questions

new topic     » goto parent     » topic index » view thread      » older message » newer message

DGuy wrote:
> Reading over the docs, a couple of qestion popped-up:
> 
> 1) What effects does task_schedule( id, 0 ) or task_schedule( id, {0,0} )
> have?

task_schedule(id, 0) will give you an error message.
You need a positive value as the repeat count.

task_schedule(id, {0,0}) is legitimate, and possibly useful. 
It schedules task id for "now" essentially.
The scheduler will run any tasks that are "overdue",
i.e. scheduled before "now", and will then run id.

I've updated the docs about this. Thanks.

> Is it the same as calling task_suspend()?

No.
 
> 2) The documentation for task_kill() reads:
> 
> [quote]
> " ... [the task] will continue executing up to the next task_yield(), but
> it may not be rescheduled (brought back to life)." 
> [/quote]
> 
> The "may not" confuses me. Is that a typo? Should it be "will not"? 

Once task_kill(id) is called, I ignore any calls that would
bring it back to life, such as task_schedule(id, ...) or even
task_suspend(id). To do otherwise would create a logical mess for me.

> Or is
> it possible for a task to call task_kill() on itself, then before
> task_yield() is hit, the same task decides to stick around and call
> task_schedule(), thus avoiding being killed?

A task can kill itself, and it will officially die once
it yields. Again, things could get too messy for me if a task
is killed but then you later try to undo the kill somehow. 
So I don't allow that.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu