- This topic has 0 replies, 1 voice, and was last updated 2 weeks, 2 days ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
(This message was transferred over from our old forum)
Posted August 19, 2015
By Todd DeBoer
[hr]
On 6/25/12 Jaybee asked, “I have created several task with the same priority running, some of the task needs to have delay however I could not use the UEZTaskDelay(); as I do not want other task to run during this delay. I tried UEZTaskSuspend and EnterCritical but some of the functions involving streamconsole cause the program to hang.
I also tried grabbing semaphores but the program stills hangs/react strangely after a few secs.
Is there a function which can block all other task from running? For example
void operation1(void)
{
//block all other task – vTaskSuspendAll()?
//create & grab semaphore?
//do my task here
//dummy delay
//release & delete semaphore?
//resume all other task – vTaskResumeAll()?
}
Thank you in advance”
[hr]
(Follow up post)
Answered:
When you want to block for short periods of time, you can use RTOS_ENTER_CRITICAL and RTOS_EXIT_CRITICAL, but you cannot do any RTOS based commands as the RTOS is no longer running (i.e., system level interrupts are turned off). These macros are usually only used for very specific hardware level accesses.
Similarly, when you want to make one task run exclusively, you can call UEZTaskSuspend() and UEZTaskResume(). Again, this usually has the same effect, but you can at least do some basic semaphoring.
If you do need a delay, we offer UEZBSPDelayMS() and UEZBSPDelayUS() which do not use the RTOS for a short delay.
In general, I don’t recommend the above routines unless there is a very strong need.