Re: Task API
- Posted by Al Getz <Xaxo at aol.com> Sep 30, 2005
- 555 views
Michael Nelson wrote: > > --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. Ideally, > I'd like</DIV> > <DIV> </DIV> > <DIV>b=task_active(i) when i is the task id and the return is a boolean</DIV> > <DIV> </DIV> > <DIV>and</DIV> > <DIV> </DIV> > <DIV>s=task_all_active() where the return is a list (pref sorted) of all > active > tasks.</DIV> > <DIV> </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> </DIV> > <DIV>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.</DIV> > <DIV> </DIV> > <DIV> </DIV> > <DIV>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 </DIV><!-- toctype = X-unknown > --><!-- toctype = text --><!-- > text --><!-- END TOC --></DIV> > --0-645872172-1128049835=:36464-- > > Hi there Mike, I had asked for those about a week ago, and Rob had said he would almost certainly implement both very soon. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"