Skip to content

Commit

Permalink
examples: spending the main thread a message queue
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
OlegHahm committed Sep 30, 2015
1 parent e3045e8 commit b538c74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/gnrc_border_router/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@
#include <stdio.h>

#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 */
Expand Down
7 changes: 7 additions & 0 deletions examples/gnrc_networking/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include <stdio.h>

#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);

Expand All @@ -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 */
Expand Down

0 comments on commit b538c74

Please # to comment.