Hello,
For your information: I have found that 'rt_post_taskswitch' is not invoked every task switch when using round-robin scheduling - only if tasks physically give up their time slice (by waiting, trying to lock a mutex, etc.). I have created a test program to reproduce this problem and informed Keil support about it.
Tamir
Are you saying that there are cases that you would like rt_post_taskswitch to be called when no task switch actaully takes place?
I might be wrong (I have been at least once before) that if a time slice expires, even if a task switch occurs - rt_post_task_switch will not be called.
It only gets called if os_dispatch()(which calls os_switch_task(), the timer tick bypasses this call)
It would be very easy to have it ALWAYS call rt_post_task_switch when the time slice expires, but I think that is very wrong if no task switch actaully happens. We will see what they come up with.
Robert,
Thanks for your reply. I only want the function to be invoked when an actual context switch occurs. I have sent a program to technical support which clearly demonstrate that it is not; tasks are switched - a scope and breakpoints prove that - but 'rt_post_taskswitch' is called only twice, probably after the tasks are created (the program contains two tasks). I can install calls to 'os_tsk_pass' to cause it to be invoked, though.
View all questions in Keil forum