diff --git a/core/sched.c b/core/sched.c index 011171861c..fcfc0173e6 100644 --- a/core/sched.c +++ b/core/sched.c @@ -99,7 +99,6 @@ static void _unschedule(thread_t *active_thread) int __attribute__((used)) sched_run(void) { - sched_context_switch_request = 0; thread_t *active_thread = (thread_t *)sched_active_thread; if (!IS_USED(MODULE_CORE_IDLE_THREAD)) { @@ -115,6 +114,8 @@ int __attribute__((used)) sched_run(void) } } + sched_context_switch_request = 0; + int nextrq = bitarithm_lsb(runqueue_bitcache); thread_t *next_thread = container_of(sched_runqueues[nextrq].next->next, thread_t, rq_entry);