core/msg: set m->sender_pid before it is used

fixes `msg_send_to_self` condition
This commit is contained in:
Ludwig Ortmann 2014-07-08 17:49:16 +02:00
parent b6f2426d16
commit d8a5ee1ec8

View File

@ -58,6 +58,7 @@ int msg_send(msg_t *m, unsigned int target_pid, bool block)
return msg_send_int(m, target_pid); return msg_send_int(m, target_pid);
} }
m->sender_pid = sched_active_pid;
if (m->sender_pid == target_pid) { if (m->sender_pid == target_pid) {
return msg_send_to_self(m); return msg_send_to_self(m);
} }
@ -66,8 +67,6 @@ int msg_send(msg_t *m, unsigned int target_pid, bool block)
tcb_t *target = (tcb_t*) sched_threads[target_pid]; tcb_t *target = (tcb_t*) sched_threads[target_pid];
m->sender_pid = sched_active_pid;
if (target == NULL) { if (target == NULL) {
DEBUG("msg_send(): target thread does not exist\n"); DEBUG("msg_send(): target thread does not exist\n");
eINT(); eINT();