I'm confused at this part. If both runqueues are empty, the bitmap scheduler will select idle as next thread. But this condition statement causes current thread not to switch to idle thread and returns directly. I replace this line as follows. In cond_2 test case, the gdb will stop at the second line but the 'do_idle' function never been executed. Is there any reason not to perform context switch while next thread is idle?
https://github.com/PikoRT/pikoRT/blob/d68fe3d070a23910b9304cca52b8c8b77c075304/kernel/sched/bitmap.c#L102
Hello
I'm confused at this part. If both runqueues are empty, the bitmap scheduler will select idle as next thread. But this condition statement causes current thread not to switch to idle thread and returns directly. I replace this line as follows. In cond_2 test case, the gdb will stop at the second line but the 'do_idle' function never been executed. Is there any reason not to perform context switch while next thread is idle?
if (next == current) return 0;
if (next == thread_idle) return 0;