core/msg: Set THREAD_FLAG_MSG_WAITING when queueing messages
This commit is contained in:
parent
acfa727151
commit
ef01efc387
12
core/msg.c
12
core/msg.c
@ -27,6 +27,9 @@
|
|||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
#if MODULE_CORE_THREAD_FLAGS
|
||||||
|
#include "thread_flags.h"
|
||||||
|
#endif
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "cib.h"
|
#include "cib.h"
|
||||||
|
|
||||||
@ -47,6 +50,10 @@ static int queue_msg(thread_t *target, const msg_t *m)
|
|||||||
DEBUG("queue_msg(): queuing message\n");
|
DEBUG("queue_msg(): queuing message\n");
|
||||||
msg_t *dest = &target->msg_array[n];
|
msg_t *dest = &target->msg_array[n];
|
||||||
*dest = *m;
|
*dest = *m;
|
||||||
|
#if MODULE_CORE_THREAD_FLAGS
|
||||||
|
target->flags |= THREAD_FLAG_MSG_WAITING;
|
||||||
|
thread_flags_wake(target);
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +144,11 @@ static int _msg_send(msg_t *m, kernel_pid_t target_pid, bool block, unsigned sta
|
|||||||
|
|
||||||
thread_add_to_list(&(target->msg_waiters), me);
|
thread_add_to_list(&(target->msg_waiters), me);
|
||||||
|
|
||||||
|
#if MODULE_CORE_THREAD_FLAGS
|
||||||
|
target->flags |= THREAD_FLAG_MSG_WAITING;
|
||||||
|
thread_flags_wake(target);
|
||||||
|
#endif
|
||||||
|
|
||||||
irq_restore(state);
|
irq_restore(state);
|
||||||
thread_yield_higher();
|
thread_yield_higher();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user