Skip to content

Commit 8f00364

Browse files
author
Amanda Butler
authored
Move example in EventQueue.md
Move example to fulfill issue #494.
1 parent 24e4bf1 commit 8f00364

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/reference/api/rtos/EventQueue.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ The code executes two handler functions (`rise_handler` and `fall_handler`) in t
2929

3030
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/events_ex_1/)](https://os.mbed.com/teams/mbed_example/code/events_ex_1/file/6ae734681f16/main.cpp)
3131

32+
### Shared event example: deferring from interrupt context
33+
34+
Like the previous example, this defers from interrupt to an event queue thread. However, rather than creating its own thread, it uses the shared event queue – potentially sharing it with other system components and saving RAM.
35+
36+
As the event queue is shared, you should limit the execution time of your event functions to avoid delaying other users’ events excessively.
37+
38+
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/Shared_Events_1/)](https://os.mbed.com/teams/mbed_example/code/Shared_Events_1/file/7c7d5b625e59/main.cpp)
39+
3240
### EventQueue example: posting events to the queue
3341

3442
The code below demonstrates queueing functions to be called after a delay and queueing functions to be called periodically.
@@ -41,14 +49,6 @@ Event queues easily align with module boundaries, where event dispatch can impli
4149

4250
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/events_ex_3/)](https://os.mbed.com/teams/mbed_example/code/events_ex_3/file/fca134a32b61/main.cpp)
4351

44-
### Shared event example: deferring from interrupt context
45-
46-
Like the previous example, this defers from interrupt to an event queue thread. However, rather than creating its own thread, it uses the shared event queue – potentially sharing it with other system components and saving RAM.
47-
48-
As the event queue is shared, you should limit the execution time of your event functions to avoid delaying other users’ events excessively.
49-
50-
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/Shared_Events_1/)](https://os.mbed.com/teams/mbed_example/code/Shared_Events_1/file/7c7d5b625e59/main.cpp)
51-
5252
### Shared event example: running the shared queue from main
5353

5454
To further save RAM, if you have no other work to do in your main function after initialization, you can dispatch the global event queue from there, avoiding the need to create a separate dispatch thread.

0 commit comments

Comments
 (0)