Skip to content
Snippets Groups Projects
Commit 4fd3d62f authored by Oleg Hahm's avatar Oleg Hahm
Browse files

core: msg_receive should yield

If a thread sends blocking, but the target thread is not currently in
receive mode, the sender gets queued. If it has a higher priority it
should run again as soon as the target goes into receiving mode.
parent fc4cf693
No related branches found
No related tags found
No related merge requests found
...@@ -310,12 +310,17 @@ static int _msg_receive(msg_t *m, int block) ...@@ -310,12 +310,17 @@ static int _msg_receive(msg_t *m, int block)
*m = *sender_msg; *m = *sender_msg;
/* remove sender from queue */ /* remove sender from queue */
uint16_t sender_prio = PRIORITY_IDLE;
if (sender->status != STATUS_REPLY_BLOCKED) { if (sender->status != STATUS_REPLY_BLOCKED) {
sender->wait_data = NULL; sender->wait_data = NULL;
sched_set_status(sender, STATUS_PENDING); sched_set_status(sender, STATUS_PENDING);
sender_prio = sender->priority;
} }
eINT(); eINT();
if (sender_prio < PRIORITY_IDLE) {
sched_switch(sender_prio);
}
return 1; return 1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment