dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 09 January 2010, 23:25 PM Post subject: Re: How do I suspend other tasks |
|
|
| FFMan wrote: | | The main program may at some point want to stop or suspend the other tasks while config changes are made. | It may be as simple as locking the task from which the changes are to be made. When a task is locked, the task switcher won't switch to another task due to an RTC tick. It is important to note, however, that if the other tasks are awaiting an external interrupt or an input capture completion and those events occur, the waiting task will still be activated even if the current task is locked.
Moreover, you must be careful not to invoke Sleep(), Delay() or similar System Library routines because those will implicitly unlock the calling task. If delays are needed in a locked task, PulseOut() can be used (for short delays) or the delay may be implemented by monitoring the value of Register.RTCTick.
An alternative is to invoke ExitTask() to cause a task to terminate. Then, after reconfiguration you can re-launch the task using CallTask(). |
|