From b538c742292f0cf0be287e04960d182ec822ba42 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Wed, 30 Sep 2015 17:56:57 +0200 Subject: [PATCH] examples: spending the main thread a message queue Since it is likely that the main thread will send netapi IPC calls that expects a reply. These replies may come faster than the thread can handle them, causing the layers below to stuck. --- examples/gnrc_border_router/main.c | 7 +++++++ examples/gnrc_networking/main.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/examples/gnrc_border_router/main.c b/examples/gnrc_border_router/main.c index 73aa63c6cc..654b411a50 100644 --- a/examples/gnrc_border_router/main.c +++ b/examples/gnrc_border_router/main.c @@ -21,9 +21,16 @@ #include #include "shell.h" +#include "msg.h" + +#define MAIN_QUEUE_SIZE (8) +static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; int main(void) { + /* we need a message queue for the thread running the shell in order to + * receive potentially fast incoming networking packets */ + msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); puts("RIOT border router example application"); /* start shell */ diff --git a/examples/gnrc_networking/main.c b/examples/gnrc_networking/main.c index c3c66f9978..6301f4291d 100644 --- a/examples/gnrc_networking/main.c +++ b/examples/gnrc_networking/main.c @@ -21,6 +21,10 @@ #include #include "shell.h" +#include "msg.h" + +#define MAIN_QUEUE_SIZE (8) +static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; extern int udp_cmd(int argc, char **argv); @@ -31,6 +35,9 @@ static const shell_command_t shell_commands[] = { int main(void) { + /* we need a message queue for the thread running the shell in order to + * receive potentially fast incoming networking packets */ + msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); puts("RIOT network stack example application"); /* start shell */