Browse Source

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.
dev/timer
Oleg Hahm 7 years ago
parent
commit
b538c74229
  1. 7
      examples/gnrc_border_router/main.c
  2. 7
      examples/gnrc_networking/main.c

7
examples/gnrc_border_router/main.c

@ -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 */

7
examples/gnrc_networking/main.c

@ -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);
@ -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 */

Loading…
Cancel
Save