1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

* msg queue optimization

This commit is contained in:
Kaspar Schleiser 2010-11-26 15:02:15 +01:00
parent 5467d08536
commit 3a83ef0824
2 changed files with 7 additions and 2 deletions

View File

@ -56,7 +56,7 @@ int msg_send(msg* m, unsigned int target_pid, bool block) {
dINT();
if (target->status != STATUS_RECEIVE_BLOCKED) {
if (queue_msg(target, m)) {
if (target->msg_array && queue_msg(target, m)) {
eINT();
return 1;
}
@ -174,7 +174,11 @@ int msg_receive(msg* m) {
tcb *me = (tcb*) sched_threads[thread_pid];
int n = cib_get(&(me->msg_queue));
int n = -1;
if (me->msg_array) {
n = cib_get(&(me->msg_queue));
}
if (n >= 0) {
DEBUG("%s: msg_receive(): We've got a queued message.\n", active_thread->name);
*m = me->msg_array[n];

View File

@ -157,6 +157,7 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void (*f
cb->msg_waiters.next = NULL;
cib_init(&(cb->msg_queue),0);
cb->msg_array = NULL;
num_tasks++;