1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/examples/ipc_pingpong
Lucas Jenss 426170b064 Improve naming of thread stacksize/priority constants
As discussed in #2725, this commit renames a number of stacksize constants to
better convey their intended usage. In addition, constants for thread priority
are given a `THREAD_` prefix. Changes are:

* KERNEL_CONF_STACKSIZE_PRINTF renamed to THREAD_EXTRA_STACKSIZE_PRINTF
* KERNEL_CONF_STACKSIZE_DEFAULT renamed to THREAD_STACKSIZE_DEFAULT
* KERNEL_CONF_STACKSIZE_IDLE renamed to THREAD_STACKSIZE_IDLE
* KERNEL_CONF_STACKSIZE_MAIN renamed to THREAD_STACKSIZE_MAIN
* Move thread stacksizes from kernel.h to thread.h, since the prefix changed
* PRIORITY_MIN renamed to THREAD_PRIORITY_MIN
* PRIORITY_IDLE renamed to THREAD_PRIORITY_IDLE
* PRIORITY_MAIN renamed to THREAD_PRIORITY_MAIN
* Move thread priorities from kernel.h to thread.h since the prefix has changed
* MINIMUM_STACK_SIZE renamed to THREAD_STACKSIZE_MINIMUM for consistency
2015-05-21 00:14:23 +02:00
..
main.c Improve naming of thread stacksize/priority constants 2015-05-21 00:14:23 +02:00
Makefile examples: use DEVELHELP per default 2014-08-01 18:49:56 +02:00
README.md examples: IPC ping-pong README adjustments 2014-05-14 15:40:52 +02:00

IPC Pingpong!

This example is to illustrate the usage of RIOTs IPC messaging system.

The application starts a second thread (in addition to the main thread) and sends messages between these two threads. The main thread calls thread_send_receive() in an endless loop. The second thread receives the message, prints 2nd: got msg from x to stdout and sends a reply message with an incrementing number back to the main thread. The main thread then prints the number it received from the 2nd thread.

The correct output should look like this:

This is RIOT! (Version: xxx)
kernel_init(): jumping into first task...
Starting IPC Ping-pong example...
1st thread started, pid: 1
2nd thread started, pid: 2
2nd: Got msg from 1
1st: Got msg with content 2
2nd: Got msg from 1
1st: Got msg with content 3
2nd: Got msg from 1
1st: Got msg with content 4
2nd: Got msg from 1
1st: Got msg with content 5
2nd: Got msg from 1
1st: Got msg with content 6
2nd: Got msg from 1
1st: Got msg with content 7
2nd: Got msg from 1
1st: Got msg with content 8
2nd: Got msg from 1
1st: Got msg with content 9
2nd: Got msg from 1
1st: Got msg with content 10
[...]