Pumpkin, Inc.

Pumpkin User Forums

Restarting a task inside another task...

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

Restarting a task inside another task...

Postby tja105 » Sun Feb 04, 2007 9:18 am

Hello,

I'm trying to do the following:

The idea is that I have a task that changes a pointer, SRAMprogram to point to a new part of a datastructure. I want to kill the task that is reading the datastructure, and restart it, so that its internal variables etc are re-initialised.

What I have is this:

for(;
{
OS_WaitBinSem(BINSEM_PWMFIN, OSNO_TIMEOUT, TASKWAVEFORM1);
if(change_program) {
routine_counter++;
if (SRAMroutine[routine_counter].program == END)
routine_counter=0;
OSDestroyTask(TASK_PWM_P);
SRAMprogram = SRAMroutine[routine_counter].program;
OSCreateTask(TaskPWM, TASK_PWM_P, PRIO_PWM);
change_program = 0;
}
else
SRAMroutine[routine_counter].tally++; // Increment the current program tally counter.

However when I try to compile it, I get:

../CDL_RTOS.c: In function `TaskWaveform':
../CDL_RTOS.c:129: error: `TaskPWM' undeclared (first use in this function)
../CDL_RTOS.c:129: error: (Each undeclared identifier is reported only once
../CDL_RTOS.c:129: error: for each function it appears in.)

the same OSCreateTask line works in main...

So, any ideas what I'm doing wrong, and / or is there a better approach to this problem?

Thank you in advance,

Tom.

tja105
 
Posts: 4
Joined: Sun Feb 04, 2007 12:00 am

Re: Restarting a task inside another task...

Postby aek » Mon Feb 05, 2007 1:09 am

You need to define a header file with your own function prototypes (including TaskPWM) and #include it in each source file that references said functions.

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

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

Re: Restarting a task inside another task...

Postby tja105 » Thu Feb 15, 2007 1:37 am

Ahh yes, thank you for that. All the functions were in the same file, but it turned out that I'd put this task in the source file above the task that it referenced...

Thanks,

Tom.

tja105
 
Posts: 4
Joined: Sun Feb 04, 2007 12:00 am


Return to Coding

Who is online

Users browsing this forum: No registered users and 4 guests

cron