1.. zephyr:code-sample:: cmsis-rtos-v2-sync 2 :name: Synchronization using CMSIS RTOS V2 APIs 3 4 Use timers and message queues from CMSIS RTOS v2 API to synchronize threads. 5 6Overview 7******** 8The sample project illustrates usage of timers and message queues using 9CMSIS RTOS V2 APIs. 10 11The main thread creates a preemptive thread which writes message to message queue 12and on timer expiry, message is read by main thread. 13 14 15Building and Running Project 16**************************** 17This project outputs to the console. It can be built and executed 18on QEMU as follows: 19 20.. zephyr-app-commands:: 21 :zephyr-app: samples/philosophers 22 :host-os: unix 23 :board: qemu_x86 24 :goals: run 25 :compact: 26 27Sample Output 28============= 29 30.. code-block:: console 31 32 Wrote to message queue: 5 33 Read from message queue: 5 34 35 Wrote to message queue: 6 36 Read from message queue: 6 37 38 Wrote to message queue: 7 39 Read from message queue: 7 40 41 Wrote to message queue: 8 42 Read from message queue: 8 43 44 Wrote to message queue: 9 45 Read from message queue: 9 46 47 Wrote to message queue: 10 48 Read from message queue: 10 49 50 Wrote to message queue: 11 51 Read from message queue: 11 52 53 Wrote to message queue: 12 54 Read from message queue: 12 55 56 Wrote to message queue: 13 57 Read from message queue: 13 58 59 Wrote to message queue: 14 60 Read from message queue: 14 61 62 Wrote to message queue: 15 63 Read from message queue: 15 64 65 Sample execution successful 66 67Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`. 68