Note! This project has moved to github.com/armmbed/mbed-events

Dependents:   SimpleHTTPExample

This repository has been superceded

This project has moved to mbed-events

Composable event loops combine the cheap synchronicity of event loops with the composability of preempted threads.

Two modular event queue classes are provided:

  • EventLoop - for loops coupled with a c++ managed thread
  • EventQueue - for manually managed event queues

The Event class takes advantage of the extensibility of FuncPtr to allow an event to be passed through APIs as a normal function.

More information on composable event loops.

Revision:
17:6d564266850e
Parent:
16:ff5d48fcce1b
Child:
20:2f9d9c53a5af
--- a/EventQueue.cpp	Mon Apr 18 09:47:21 2016 -0500
+++ b/EventQueue.cpp	Mon Apr 18 12:51:04 2016 -0500
@@ -71,9 +71,9 @@
             e->dispatch(reinterpret_cast<void *>(e + 1));
 
             if (e->period >= 0) {
-                trigger(e, e->period);
+                event_trigger(e, e->period);
             } else {
-                dealloc(e);
+                event_dealloc(e);
             }
         }
 
@@ -88,7 +88,7 @@
     }
 }
 
-void EventQueue::trigger(struct event *e, int delay) {
+void EventQueue::event_trigger(struct event *e, int delay) {
     e->target = get_tick() + (unsigned)delay;
 
     unsigned primask = irq_disable();
@@ -102,7 +102,7 @@
     irq_enable(primask);
 }
 
-EventQueue::event *EventQueue::alloc(unsigned size, int ms) {
+EventQueue::event *EventQueue::event_alloc(unsigned size, int ms) {
     if (size > _event_context) {
         return 0;
     }
@@ -131,7 +131,7 @@
     }
 }
 
-void EventQueue::dealloc(struct event *e) {
+void EventQueue::event_dealloc(struct event *e) {
     unsigned primask = irq_disable();
     e->next = _free;
     _free = e;