Skip to content
Snippets Groups Projects
Unverified Commit aa90f93d authored by Kaspar Schleiser's avatar Kaspar Schleiser Committed by GitHub
Browse files

Merge pull request #10891 from kaspar030/fix_native_thread_yield_higher

cpu/native: fix race in thread_yield_higher()
parents 49f27159 82b2362b
No related branches found
No related tags found
No related merge requests found
...@@ -330,6 +330,7 @@ static int _msg_receive(msg_t *m, int block) ...@@ -330,6 +330,7 @@ static int _msg_receive(msg_t *m, int block)
thread_yield_higher(); thread_yield_higher();
/* sender copied message */ /* sender copied message */
assert(sched_active_thread->status != STATUS_RECEIVE_BLOCKED);
} }
else { else {
irq_restore(state); irq_restore(state);
......
...@@ -208,6 +208,8 @@ void isr_thread_yield(void) ...@@ -208,6 +208,8 @@ void isr_thread_yield(void)
void thread_yield_higher(void) void thread_yield_higher(void)
{ {
sched_context_switch_request = 1;
if (_native_in_isr == 0) { if (_native_in_isr == 0) {
ucontext_t *ctx = (ucontext_t *)(sched_active_thread->sp); ucontext_t *ctx = (ucontext_t *)(sched_active_thread->sp);
_native_in_isr = 1; _native_in_isr = 1;
...@@ -224,9 +226,6 @@ void thread_yield_higher(void) ...@@ -224,9 +226,6 @@ void thread_yield_higher(void)
} }
irq_enable(); irq_enable();
} }
else {
sched_context_switch_request = 1;
}
} }
void native_cpu_init(void) void native_cpu_init(void)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment