diff --git a/core/msg.c b/core/msg.c index 82d164e336..3492f24a1c 100644 --- a/core/msg.c +++ b/core/msg.c @@ -58,6 +58,7 @@ int msg_send(msg_t *m, unsigned int target_pid, bool block) return msg_send_int(m, target_pid); } + m->sender_pid = sched_active_pid; if (m->sender_pid == target_pid) { 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]; - m->sender_pid = sched_active_pid; - if (target == NULL) { DEBUG("msg_send(): target thread does not exist\n"); eINT();