mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
SQUASHME: do it right
This commit is contained in:
parent
d8a5ee1ec8
commit
2a859c78cd
@ -58,8 +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 ((unsigned int)sched_active_pid == target_pid) {
|
||||||
if (m->sender_pid == target_pid) {
|
|
||||||
return msg_send_to_self(m);
|
return msg_send_to_self(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +66,8 @@ 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();
|
||||||
@ -134,6 +135,7 @@ int msg_send_to_self(msg_t *m)
|
|||||||
{
|
{
|
||||||
unsigned int state = disableIRQ();
|
unsigned int state = disableIRQ();
|
||||||
|
|
||||||
|
m->sender_pid = sched_active_pid;
|
||||||
int res = queue_msg((tcb_t *) sched_active_thread, m);
|
int res = queue_msg((tcb_t *) sched_active_thread, m);
|
||||||
|
|
||||||
restoreIRQ(state);
|
restoreIRQ(state);
|
||||||
|
Loading…
Reference in New Issue
Block a user