
Shared event example. Instead of creating special thread user can use shared event queue and dispatch the global event queue from main thread.
Fork of Shared_Events_1 by
Diff: main.cpp
- Revision:
- 1:154179bdc39d
- Parent:
- 0:7c7d5b625e59
diff -r 7c7d5b625e59 -r 154179bdc39d main.cpp --- a/main.cpp Mon Dec 18 16:50:19 2017 +0000 +++ b/main.cpp Mon Dec 18 16:58:28 2017 +0000 @@ -21,6 +21,8 @@ printf("Starting in context %p\r\n", Thread::gettid()); // The 'rise' handler will execute in IRQ context sw.rise(rise_handler); - // The 'fall' handler will execute in the context of the shared queue thread + // The 'fall' handler will execute in the context of the shared queue (actually the main thread) sw.fall(queue->event(fall_handler)); + // Setup complete, so we now dispatch the shared queue from main + queue->dispatch_forever(); }