Task API

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

--0-645872172-1128049835=:36464
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

I simply must have a way of determining what tasks are active.  Ideally, I'd
like
 
b=task_active(i) when i is the task id and the return is a boolean
 
and
 
s=task_all_active()   where the return is a list (pref sorted) of all active
tasks.
 
It is not possible to maintain an accurate list of active tasks; I can redefine
task_schedule and add the id to the active list, and redefine task_suspend and
task_kill to remove it from the list, but I have no way to remove a task from the
list when it dies by returning from the task procedure.
 
Why I want this is for the termination routine for ME. I want to define it as
its own task which will yield and not do any work until it is the only task
running. This could also be used in a genric task library.  You have the list of
active tasks on hand internally, so implementation shouldn't be too difficult.
 
 
As an alternative, if you want to keep the interface the same while allowing
accurate lists of active tasks to be maintained, you could change the behavior or
a return from a task procedure--let it act like task_yield rather than
task_kill--unless the task had supended or killed itself, it would remain active
on the same schedule and the procedure would be called at its next turn with the
parmaters from task_create


--0-645872172-1128049835=:36464
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<DIV>
<DIV>I simply must have a way of determining what tasks are active.&nbsp;
Ideally, I'd like</DIV>
<DIV>&nbsp;</DIV>
<DIV>b=task_active(i) when i is the task id and the return is a boolean</DIV>
<DIV>&nbsp;</DIV>
<DIV>and</DIV>
<DIV>&nbsp;</DIV>
<DIV>s=task_all_active()&nbsp;&nbsp; where the return is a list (pref sorted) of
all active tasks.</DIV>
<DIV>&nbsp;</DIV>
<DIV>It is not possible to maintain an accurate list of active tasks; I can
redefine task_schedule and add the id to the active list, and redefine
task_suspend and task_kill to remove it from the list, but I have no way to
remove a task from the list when it dies by returning from the task
procedure.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Why I want this is for the termination routine for ME. I want to define it
as its own task which will&nbsp;yield and not do any work until it is the only
task running. This could also be used in a genric task library.&nbsp; You have
the list of active tasks on hand internally, so implementation shouldn't be too
difficult.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>As an alternative, if you want to keep the interface&nbsp;the
same&nbsp;while allowing accurate lists of active tasks to be maintained, you
could change the behavior or a return from a task procedure--let it act like
task_yield rather than task_kill--unless the task had supended or killed itself,
it would remain active on the same schedule and the procedure would be called at
its next turn with the parmaters from task_create&nbsp;</DIV><!-- toctype =
X-unknown --><!-- toctype = text --><!-- text --><!-- END TOC --></DIV>
--0-645872172-1128049835=:36464--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu