1. MultiTasking: Needs "id_running?" function

Hello,


I find that there is no function in the MT preview release to call to
find out if a particular task is running or not.  This is rather important
to have in some apps that will allow user input to determine which
threads will be run.  Some tasks will not be allowed to start if yet
some other tasks are running.

For example, the user clicks "Save" which starts the file save task for
that app, then clicks "Exit" while the file save is still in progress.
Obviously you want to stop the program from aborting and display a 
message telling the user to wait for the file save to complete.

  if task_running(Task_ID1) then
    MessageBoxOk("Your data is being saved...please wait...")
  end if

There's also the possibility (optional) of detecting if *any* tasks are still
running (other than task=0) with something like this:

  if task_any_running() then
    --(code here)
  end if


Yes, i could manage keeping track of running (or not) tasks myself,
but then i'd have to re-wrap some of the task function calls :)


Take care,
Al

And, good luck with your Euphoria programming!

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

new topic     » topic index » view message » categorize

2. Re: MultiTasking: Needs "id_running?" function

Al Getz wrote:
> I find that there is no function in the MT preview release to call to
> find out if a particular task is running or not.  This is rather important
> to have in some apps that will allow user input to determine which
> threads will be run.  Some tasks will not be allowed to start if yet
> some other tasks are running.
> 
> For example, the user clicks "Save" which starts the file save task for
> that app, then clicks "Exit" while the file save is still in progress.
> Obviously you want to stop the program from aborting and display a 
> message telling the user to wait for the file save to complete.
> 
>   if task_running(Task_ID1) then
>     MessageBoxOk("Your data is being saved...please wait...")
>   end if
> 
> There's also the possibility (optional) of detecting if *any* tasks are still
> running (other than task=0) with something like this:
> 
>   if task_any_running() then
>     --(code here)
>   end if

I'll accept your vote for those. There's a very good chance I'll do them.
I figured that if you are waiting for a task to finish, it's probably
because you are waiting for some variable to be set, and you could
check the variable.

The initial API is the minimum that I thought was needed.
It would be easy to add other calls, but I wanted to see what
people would ask for before I started adding stuff that might be 
rarely used or unnecessary.

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: MultiTasking: Needs "id_running?" function

Robert Craig wrote:
> 
> I'll accept your vote for those. There's a very good chance I'll do them.
> I figured that if you are waiting for a task to finish, it's probably
> because you are waiting for some variable to be set, and you could
> check the variable.
> 
> The initial API is the minimum that I thought was needed.
> It would be easy to add other calls, but I wanted to see what
> people would ask for before I started adding stuff that might be 
> rarely used or unnecessary.
> 
> Thanks,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>
> 

Cool, so are you going to submit an update to your tasked PD-Source contribution
when you finish?

You might want to update the news page mentioning you released it for public
testing. I have not found any problems so far, hopefully this luck will remain
when implemented in the C backend and translator. But of course there is time to
catch any issues/bugs in the Alpha and Beta Euphoria releases.


Regards,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

new topic     » goto parent     » topic index » view message » categorize

4. Re: MultiTasking: Needs "id_running?" function

Vincent wrote:
> Cool, so are you going to submit an update to your tasked PD-Source
> contribution when
> you finish?

Yes.

> You might want to update the news page mentioning you released it for public
> testing.

Thanks. I just added a blurb to the news page.

> I have not found any problems so far, hopefully this luck will remain when
> implemented
> in the C backend and translator. But of course there is time to catch any
> issues/bugs
> in the Alpha and Beta Euphoria releases.

It was much easier to implement this stuff in the PD (Euphoria) 
source than it would have been in C (for the usual reasons). 
But I expect it will now be pretty straightforward to copy 
the functionality into C. Most of the conceptual problems 
and high-level issues have been ironed out.

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

new topic     » goto parent     » topic index » view message » categorize

5. Re: MultiTasking: Needs "id_running?" function

I'd vote in favor of this addittion to the task API. It makes life 
simpler for the programmer as it will not be necesary to define a global 
just to act as a flag for whether a task is running--not essential but 
very handy and doesn't seem difficult to implement or use.

Might I suggest task_active as the name of the function?

-- Mike Nelson

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu