1. Multi-Tasking Questions
- Posted by DGuy <dguy-o000 at usa.net> Dec 08, 2005
- 520 views
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? Is it the same as calling task_suspend()? 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"? Or is it possible for a task to call task_kill() on itself, then before task_yield() is hit, the same task decides to sick around and call task_schedule(), thus avoiding being killed?
2. Re: Multi-Tasking Questions
- Posted by Robert Craig <rds at RapidEuphoria.com> Dec 08, 2005
- 535 views
- Last edited Dec 09, 2005
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