We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I would like to briefly increase the priority of a currently running task and then revert the priority level.
The example given at:
www.keil.com/.../rlarm_os_tsk_prio_self.htm
shows how to do this.
void task1 (void) __task { . . os_tsk_prio_self(10); /* Increase its priority, for the critical section */ . /* This is a critical section */ . os_tsk_prio_self(2); /* Decrease its priority at end of critical section */ . . }
Trouble is, I would like to include this boost within a routine used by various tasks. I know at design time what level to boost to, but the level to return to would need to be determined at run time.
OldPriority = CURRENT_TASK_PRIORITY_LEVEL; . . os_tsk_prio_self(10); . . os_tsk_prio_self(OldPriority);
I've looked for a function to determine the current task priority level, but cannot find one.
Anyone know of a way of doing this?
"Yep, convoluted, ..."
It does sound a little more complex than I think it needs be (like, for example, the RTX freely giving the information).
But ... Your idea intrigues me, so I might well giving it some thought over the weekend.