Re: Use of Multi-Tasking feature

new topic     » goto parent     » topic index » view thread      » older message » newer message
cp said...

I have a program that will have two real-time tasks and one shared task. I need some clarification on how the procedures linked to the tasks need to be coded. The examples and docs indicate that for real-time tasks, the procedure needs a controlling loop (for or while) to make it run "forever" or x times.

...snip...

Is this required? Does this coding technique also apply to procedures that will be time shared. ie. If I have:

The answer, of course, is: It depends!

It depends on how you want the task to work. If you want the task to continue running forever, then you need the while loop. When the task returns from its routine, the task ends, so if you want it to run again, you'll need to reschedule it.

So if it's a periodic thing that always has to happen, you probably want the while loop. If it's a one time thing that you just want to play nice with the rest of the system, you may need to yield occasionally, depending on how long it takes to finish, but then just let it return to end the task.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu