1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sched: Clear context_switch_request after potential idle sleep

An interrupt serviced during the idle sleep can re-request a context
switch while the scheduler is already going to switch contexts after the
idle sleep. Thi sched_context_switch_request should thus be cleared
after the idle sleep and not before where it could be modified during
the idle sleep and get out of sync.
This commit is contained in:
Koen Zandberg 2020-07-21 11:27:08 +02:00
parent 0eb66a429f
commit 2d74651237
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B

View File

@ -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);