Re: Task API

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

Vincent wrote:
> 
> Robert Craig wrote:
> > 
> > Michael Nelson wrote:
> > > 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.
> > 
> > I'm pretty sure I'm going to implement both of those (more or less).
> > I probably won't sort them by task id. You'll have to do that.
> > 
> > Would you like suspended tasks to be included in the list
> > of active tasks? Should task_active() distinguish between
> > suspended and normally-active tasks?
> > 
> > Regards,
> >    Rob Craig
> >    Rapid Deployment Software
> >    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
> > 
> 
> Rob how about you make a task_list() that returns a 2 dimentional sequence.
> The first
> having a list of active task IDs, and the second sequence having a list of
> inactive
> (suspended) task IDs. This way, there would only need one routine vs two.
> 
> 
> Regards,
> Vincent
> 
> ----------------------------------------------
>      ___	      __________      ___
>     /__/\            /__________\    |\ _\
>     \::\'\          //::::::::::\\   |'|::|
>      \::\'\        //:::_::::_:::\\  |'|::|
>       \::\'\      //::/  |::|  \::\\ |'|::|
>        \::\'\    //::/   |::|   \::\\|'|::|
>         \::\'\__//::/    |::|    \::\|'|::|
>          \::\','/::/     |::|     \::\\|::|
>           \::\_/::/      |::|      \::\|::|
>            \::,::/       |::|       \:::::|
>             \___/        |__|        \____|
> 
>  	                 .``.
> 		         ',,'
> 
> 

Hi Vincent,

I ended up doing that with my Win demo.  The sequence has one
element per task, and if the task is active it has a 1 in that
slot.  The sequence can then be checked for a particular task...

if task[1] then
  puts(1,"task 1 is running")
end if
if task[2] then
  puts(1,"task 2 is running")
end if

etc., etc.

With the source code however, we'd also might need a cross ref table to
tell us which sequence element goes with which task...

if task[taskids[1]] then
  puts(1,"task 1 is running")
end if

if task[taskids[2]] then
  puts(1,"task 2 is running")
end if

I have a preference for one level per sequence, so that it's faster
to check what you're looking for...if you're checking to see if it's
running task_run[1] or task_suspended[1] would be nice,
task[1][IS_RUNNING] or task[1][IS_SUSPENDED] is going to be slower
for libs that have to constantly check.

BTW, doing it 'manually' means you have to be careful to make sure
you set (and reset) the sequence element at the right times.  Would be
better to re-wrap the function calls i guess.


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

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

Search



Quick Links

User menu

Not signed in.

Misc Menu