Pumpkin, Inc.

Pumpkin User Forums

Stop/restart Tasks

If you can't make Salvo do what you want it to do, post it here.

Stop/restart Tasks

Postby JOwsley » Fri Dec 06, 2002 3:02 am

I have a method starts or stops a task, MYTASK_P, which is OS_Delay() based. If the task is re-triggered, I want it to reset the delay it has:
code:
void control(bool YN)
{
if (YN)
{
OSStopTask(MYTASK_P);
OSStartTask(MYTASK_P);
}
else
OSStopTask(MYTASK_P);
}

void MyTask()
{
for(;;)
{
OS_Delay(MYTIMEOUT, Mytask1);
}
}


Should I wait a small amount of time before re-starting? For this example, YN is TRUE. Can those functions be called back-to-back?

[This message has been edited by aek (edited December 06, 2002).]

Jake Owsley, PE
JOwsley
 
Posts: 4
Joined: Thu Dec 05, 2002 12:00 am
Location: Louisville, CO, USA

Re: Stop/restart Tasks

Postby aek » Fri Dec 06, 2002 4:47 am

For
code:
void control(bool YN)
{
OSStopTask(MYTASK_P);

if (YN)
{
OSStartTask(MYTASK_P);
}
}


or the way you've written it I can't see any reason why you can't call the services back-to-back ...

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron