Pumpkin, Inc.

Pumpkin User Forums

OSCreate and OS_Replace

If you have a general question or comment regarding Salvo, post it here.

OSCreate and OS_Replace

Postby luben » Tue Nov 05, 2002 9:03 am

Hello,

I made a mistake in my last project, creating 2 different tasks with the same TCB. The OSSched was not running - just I created 2 tasks one after other with the same TCB. The result was that the first task j was not running at all. The second task was working without visible problems. And of course there was no error message - neigther in the compiling nor in the linking.

My question is - if I do the same mistake after OSShed was alrady called, what could happen.... I know that OS_Replace is already made and tested, but why you just don't call OSCreate again from the main level, if you want to replace one task with other. Or to say it with other words - is it possible to use OSCreate(TASK_n,..) from other then the Task_n task instead of OS_Replace?


Regards
Luben

luben
 
Posts: 324
Joined: Sun Nov 19, 2000 12:00 am
Location: Sofia, Bulgaria

Re: OSCreate and OS_Replace

Postby aek » Tue Nov 05, 2002 9:31 am

Hi Luben.
quote:
And of course there was no error message - neigther in the compiling nor in the linking.
Nor during runtime -- we made the choice to allow users to "overwrite" tasks with new tasks because ultimately it saves ROM. But you do have to be careful ...
quote:
is it possible to use OSCreate(TASK_n,..) from other then the Task_n task instead of OS_Replace?
Yes, you can, but with caution. It really only works if the task is stopped or eligible. If the task is delayed or waiting on an event, things will break because OSCreateTask() does not remove a task from the queue(s) it's in. That's why you should use OS_Replace() (which only works on the current, running task -- obviously) because it avoids these problems.

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

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


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron