21#include "events/equeue.h"
22#include "platform/Callback.h"
23#include "platform/NonCopyable.h"
39#define EVENTS_EVENT_SIZE \
40 (EQUEUE_EVENT_SIZE - 2*sizeof(void*) + sizeof(mbed::Callback<void()>))
45#define EVENTS_QUEUE_SIZE (32*EVENTS_EVENT_SIZE)
50template <
typename F,
typename A>
64 using duration = std::chrono::duration<int, std::milli>;
119 MBED_DEPRECATED_SINCE(
"mbed-os-6.7.0",
"Use dispatch_for() to pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
194 template<typename F, typename A>
197 if (
event->_equeue != &_equeue) {
200 return equeue_cancel_user_allocated(&_equeue,
event);
240 template<
typename F,
typename A>
246 return equeue_timeleft_user_allocated(&_equeue, &
event->_e);
289#if defined(DOXYGEN_ONLY)
321 template <
typename F,
typename ...Args>
372 template <
typename T,
typename R,
typename ...Args>
373 int call(T *obj, R (T::*method)(Args ...args), Args ...args);
407 template <
typename F,
typename ...ArgTs>
458 template <
typename T,
typename R,
typename ...ArgTs>
459 int call_in(duration ms, T *obj, R (T::*method)(ArgTs ...args), ArgTs ...args);
506 template <
typename F,
typename ...ArgTs>
557 template <
typename T,
typename R,
typename ...ArgTs>
558 int call_every(duration ms, T *obj, R (T::*method)(ArgTs ...args), ArgTs ...args);
603 template <
typename R,
typename ...BoundArgTs,
typename ...ContextArgTs,
typename ...ArgTs>
604 Event<void(ArgTs...)>
event(R (*func)(BoundArgTs..., ArgTs...), ContextArgTs ...context_args);
651 template <
typename T,
typename R,
typename ...BoundArgTs,
typename ...ContextArgTs,
typename ...ArgTs>
652 Event<void(ArgTs...)>
event(T *obj, R (T::*method)(BoundArgTs..., ArgTs...), ContextArgTs ...context_args);
690 template <
typename R,
typename ...BoundArgTs,
typename ...ContextArgTs,
typename ...ArgTs>
731 template <
typename F,
typename... ArgTs>
737 template <
typename T,
typename R,
typename... ArgTs>
774 template <
typename F>
777 void *p = equeue_alloc(&_equeue,
sizeof(F));
782 F *e =
new (p) F(std::move(f));
783 equeue_event_dtor(e, &EventQueue::function_dtor<F>);
784 return equeue_post(&_equeue, &EventQueue::function_call<F>, e);
793 template <
typename F,
typename... ArgTs>
794 int call(F f, ArgTs... args)
796 return call(context<F, ArgTs...>(std::move(f), args...));
802 template <
typename T,
typename R,
typename... ArgTs>
803 int call(T *obj, R(T::*method)(ArgTs...), ArgTs... args)
811 template <
typename T,
typename R,
typename... ArgTs>
812 int call(
const T *obj, R(T::*method)(ArgTs...)
const, ArgTs... args)
820 template <
typename T,
typename R,
typename... ArgTs>
821 int call(
volatile T *obj, R(T::*method)(ArgTs...)
volatile, ArgTs... args)
829 template <
typename T,
typename R,
typename... ArgTs>
830 int call(
const volatile T *obj, R(T::*method)(ArgTs...)
const volatile, ArgTs... args)
849 template <
typename F>
852 void *p = equeue_alloc(&_equeue,
sizeof(F));
857 F *e =
new (p) F(std::move(f));
858 equeue_event_delay(e, ms.count());
859 equeue_event_dtor(e, &EventQueue::function_dtor<F>);
860 return equeue_post(&_equeue, &EventQueue::function_call<F>, e);
869 template <
typename F,
typename... ArgTs>
870 int call_in(duration ms, F f, ArgTs... args)
872 return call_in(ms, context<F, ArgTs...>(std::move(f), args...));
878 template <
typename T,
typename R,
typename... ArgTs>
879 int call_in(duration ms, T *obj, R(T::*method)(ArgTs...), ArgTs... args)
887 template <
typename T,
typename R,
typename... ArgTs>
888 int call_in(duration ms,
const T *obj, R(T::*method)(ArgTs...)
const, ArgTs... args)
896 template <
typename T,
typename R,
typename... ArgTs>
897 int call_in(duration ms,
volatile T *obj, R(T::*method)(ArgTs...)
volatile, ArgTs... args)
905 template <
typename T,
typename R,
typename... ArgTs>
906 int call_in(duration ms,
const volatile T *obj, R(T::*method)(ArgTs...)
const volatile, ArgTs... args)
925 template <
typename F>
926 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
929 return call_in(duration(ms), std::move(f));
938 template <
typename F,
typename... ArgTs>
939 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
940 int
call_in(
int ms, F f, ArgTs... args)
942 return call_in(duration(ms), std::move(f), args...);
948 template <
typename T,
typename R,
typename... ArgTs>
949 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
950 int
call_in(
int ms, T *obj, R(T::*method)(ArgTs...), ArgTs... args)
952 return call_in(duration(ms), obj, method, args...);
958 template <
typename T,
typename R,
typename... ArgTs>
959 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
960 int
call_in(
int ms, const T *obj, R(T::*method)(ArgTs...) const, ArgTs... args)
962 return call_in(duration(ms), obj, method, args...);
968 template <
typename T,
typename R,
typename... ArgTs>
969 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
970 int
call_in(
int ms, volatile T *obj, R(T::*method)(ArgTs...) volatile, ArgTs... args)
972 return call_in(duration(ms), obj, method, args...);
978 template <
typename T,
typename R,
typename... ArgTs>
979 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
980 int
call_in(
int ms, const volatile T *obj, R(T::*method)(ArgTs...) const volatile, ArgTs... args)
982 return call_in(duration(ms), obj, method, args...);
1002 template <
typename F>
1005 void *p = equeue_alloc(&_equeue,
sizeof(F));
1010 F *e =
new (p) F(std::move(f));
1011 equeue_event_delay(e, ms.count());
1012 equeue_event_period(e, ms.count());
1013 equeue_event_dtor(e, &EventQueue::function_dtor<F>);
1014 return equeue_post(&_equeue, &EventQueue::function_call<F>, e);
1023 template <
typename F,
typename... ArgTs>
1024 int call_every(duration ms, F f, ArgTs... args)
1026 return call_every(ms, context<F, ArgTs...>(std::move(f), args...));
1032 template <
typename T,
typename R,
typename... ArgTs>
1033 int call_every(duration ms, T *obj, R(T::*method)(ArgTs...), ArgTs... args)
1041 template <
typename T,
typename R,
typename... ArgTs>
1042 int call_every(duration ms,
const T *obj, R(T::*method)(ArgTs...)
const, ArgTs... args)
1050 template <
typename T,
typename R,
typename... ArgTs>
1051 int call_every(duration ms,
volatile T *obj, R(T::*method)(ArgTs...)
volatile, ArgTs... args)
1059 template <
typename T,
typename R,
typename... ArgTs>
1060 int call_every(duration ms,
const volatile T *obj, R(T::*method)(ArgTs...)
const volatile, ArgTs... args)
1082 template <
typename F>
1083 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
1086 return call_every(duration(ms), std::move(f));
1095 template <
typename F,
typename... ArgTs>
1096 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
1099 return call_every(duration(ms), std::move(f), args...);
1105 template <
typename T,
typename R,
typename... ArgTs>
1106 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
1107 int
call_every(
int ms, T *obj, R(T::*method)(ArgTs...), ArgTs... args)
1109 return call_every(duration(ms), obj, method, args...);
1115 template <
typename T,
typename R,
typename... ArgTs>
1116 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
1117 int
call_every(
int ms, const T *obj, R(T::*method)(ArgTs...) const, ArgTs... args)
1119 return call_every(duration(ms), obj, method, args...);
1125 template <
typename T,
typename R,
typename... ArgTs>
1126 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
1127 int
call_every(
int ms, volatile T *obj, R(T::*method)(ArgTs...) volatile, ArgTs... args)
1129 return call_every(duration(ms), obj, method, args...);
1135 template <
typename T,
typename R,
typename... ArgTs>
1136 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
1137 int
call_every(
int ms, const volatile T *obj, R(T::*method)(ArgTs...) const volatile, ArgTs... args)
1139 return call_every(duration(ms), obj, method, args...);
1151 template <
typename R,
typename... ArgTs>
1152 Event<void(ArgTs...)>
event(R(*func)(ArgTs...));
1157 template <
typename T,
typename R,
typename... ArgTs>
1158 Event<void(ArgTs...)>
event(T *obj, R(T::*method)(ArgTs...));
1163 template <
typename T,
typename R,
typename... ArgTs>
1164 Event<void(ArgTs...)>
event(
const T *obj, R(T::*method)(ArgTs...)
const);
1169 template <
typename T,
typename R,
typename... ArgTs>
1170 Event<void(ArgTs...)>
event(
volatile T *obj, R(T::*method)(ArgTs...)
volatile);
1175 template <
typename T,
typename R,
typename... ArgTs>
1176 Event<void(ArgTs...)>
event(
const volatile T *obj, R(T::*method)(ArgTs...)
const volatile);
1181 template <
typename R,
typename... ArgTs>
1187 template <
typename R,
typename B0,
typename C0,
typename... ArgTs>
1188 Event<void(ArgTs...)>
event(R(*func)(B0, ArgTs...), C0 c0);
1193 template <
typename T,
typename R,
typename B0,
typename C0,
typename... ArgTs>
1194 Event<void(ArgTs...)>
event(T *obj, R(T::*method)(B0, ArgTs...), C0 c0);
1199 template <
typename T,
typename R,
typename B0,
typename C0,
typename... ArgTs>
1200 Event<void(ArgTs...)>
event(
const T *obj, R(T::*method)(B0, ArgTs...)
const, C0 c0);
1205 template <
typename T,
typename R,
typename B0,
typename C0,
typename... ArgTs>
1206 Event<void(ArgTs...)>
event(
volatile T *obj, R(T::*method)(B0, ArgTs...)
volatile, C0 c0);
1211 template <
typename T,
typename R,
typename B0,
typename C0,
typename... ArgTs>
1212 Event<void(ArgTs...)>
event(
const volatile T *obj, R(T::*method)(B0, ArgTs...)
const volatile, C0 c0);
1217 template <
typename R,
typename B0,
typename C0,
typename... ArgTs>
1223 template <
typename R,
typename B0,
typename B1,
typename C0,
typename C1,
typename... ArgTs>
1224 Event<void(ArgTs...)>
event(R(*func)(B0, B1, ArgTs...), C0 c0, C1 c1);
1229 template <
typename T,
typename R,
typename B0,
typename B1,
typename C0,
typename C1,
typename... ArgTs>
1230 Event<void(ArgTs...)>
event(T *obj, R(T::*method)(B0, B1, ArgTs...), C0 c0, C1 c1);
1235 template <
typename T,
typename R,
typename B0,
typename B1,
typename C0,
typename C1,
typename... ArgTs>
1236 Event<void(ArgTs...)>
event(
const T *obj, R(T::*method)(B0, B1, ArgTs...)
const, C0 c0, C1 c1);
1241 template <
typename T,
typename R,
typename B0,
typename B1,
typename C0,
typename C1,
typename... ArgTs>
1242 Event<void(ArgTs...)>
event(
volatile T *obj, R(T::*method)(B0, B1, ArgTs...)
volatile, C0 c0, C1 c1);
1247 template <
typename T,
typename R,
typename B0,
typename B1,
typename C0,
typename C1,
typename... ArgTs>
1248 Event<void(ArgTs...)>
event(
const volatile T *obj, R(T::*method)(B0, B1, ArgTs...)
const volatile, C0 c0, C1 c1);
1253 template <
typename R,
typename B0,
typename B1,
typename C0,
typename C1,
typename... ArgTs>
1259 template <
typename R,
typename B0,
typename B1,
typename B2,
typename C0,
typename C1,
typename C2,
typename... ArgTs>
1260 Event<void(ArgTs...)>
event(R(*func)(B0, B1, B2, ArgTs...), C0 c0, C1 c1, C2 c2);
1265 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename C0,
typename C1,
typename C2,
typename... ArgTs>
1266 Event<void(ArgTs...)>
event(T *obj, R(T::*method)(B0, B1, B2, ArgTs...), C0 c0, C1 c1, C2 c2);
1271 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename C0,
typename C1,
typename C2,
typename... ArgTs>
1272 Event<void(ArgTs...)>
event(
const T *obj, R(T::*method)(B0, B1, B2, ArgTs...)
const, C0 c0, C1 c1, C2 c2);
1277 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename C0,
typename C1,
typename C2,
typename... ArgTs>
1278 Event<void(ArgTs...)>
event(
volatile T *obj, R(T::*method)(B0, B1, B2, ArgTs...)
volatile, C0 c0, C1 c1, C2 c2);
1283 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename C0,
typename C1,
typename C2,
typename... ArgTs>
1284 Event<void(ArgTs...)>
event(
const volatile T *obj, R(T::*method)(B0, B1, B2, ArgTs...)
const volatile, C0 c0, C1 c1, C2 c2);
1289 template <
typename R,
typename B0,
typename B1,
typename B2,
typename C0,
typename C1,
typename C2,
typename... ArgTs>
1290 Event<void(ArgTs...)>
event(
mbed::Callback<R(B0, B1, B2, ArgTs...)> cb, C0 c0, C1 c1, C2 c2);
1295 template <
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename C0,
typename C1,
typename C2,
typename C3,
typename... ArgTs>
1296 Event<void(ArgTs...)>
event(R(*func)(B0, B1, B2, B3, ArgTs...), C0 c0, C1 c1, C2 c2, C3 c3);
1301 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename C0,
typename C1,
typename C2,
typename C3,
typename... ArgTs>
1302 Event<void(ArgTs...)>
event(T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...), C0 c0, C1 c1, C2 c2, C3 c3);
1307 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename C0,
typename C1,
typename C2,
typename C3,
typename... ArgTs>
1308 Event<void(ArgTs...)>
event(
const T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...)
const, C0 c0, C1 c1, C2 c2, C3 c3);
1313 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename C0,
typename C1,
typename C2,
typename C3,
typename... ArgTs>
1314 Event<void(ArgTs...)>
event(
volatile T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...)
volatile, C0 c0, C1 c1, C2 c2, C3 c3);
1319 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename C0,
typename C1,
typename C2,
typename C3,
typename... ArgTs>
1320 Event<void(ArgTs...)>
event(
const volatile T *obj, R(T::*method)(B0, B1, B2, B3, ArgTs...)
const volatile, C0 c0, C1 c1, C2 c2, C3 c3);
1325 template <
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename C0,
typename C1,
typename C2,
typename C3,
typename... ArgTs>
1326 Event<void(ArgTs...)>
event(
mbed::Callback<R(B0, B1, B2, B3, ArgTs...)> cb, C0 c0, C1 c1, C2 c2, C3 c3);
1331 template <
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename B4,
typename C0,
typename C1,
typename C2,
typename C3,
typename C4,
typename... ArgTs>
1332 Event<void(ArgTs...)>
event(R(*func)(B0, B1, B2, B3, B4, ArgTs...), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4);
1337 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename B4,
typename C0,
typename C1,
typename C2,
typename C3,
typename C4,
typename... ArgTs>
1338 Event<void(ArgTs...)>
event(T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...), C0 c0, C1 c1, C2 c2, C3 c3, C4 c4);
1343 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename B4,
typename C0,
typename C1,
typename C2,
typename C3,
typename C4,
typename... ArgTs>
1344 Event<void(ArgTs...)>
event(
const T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...)
const, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4);
1349 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename B4,
typename C0,
typename C1,
typename C2,
typename C3,
typename C4,
typename... ArgTs>
1350 Event<void(ArgTs...)>
event(
volatile T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...)
volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4);
1355 template <
typename T,
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename B4,
typename C0,
typename C1,
typename C2,
typename C3,
typename C4,
typename... ArgTs>
1356 Event<void(ArgTs...)>
event(
const volatile T *obj, R(T::*method)(B0, B1, B2, B3, B4, ArgTs...)
const volatile, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4);
1361 template <
typename R,
typename B0,
typename B1,
typename B2,
typename B3,
typename B4,
typename C0,
typename C1,
typename C2,
typename C3,
typename C4,
typename... ArgTs>
1362 Event<void(ArgTs...)>
event(
mbed::Callback<R(B0, B1, B2, B3, B4, ArgTs...)> cb, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4);
1373 template <
typename F,
typename... ArgTs>
1379 template <
typename T,
typename R,
typename... ArgTs>
1385 template <
typename T,
typename R,
typename... ArgTs>
1391 template <
typename T,
typename R,
typename... ArgTs>
1397 template <
typename T,
typename R,
typename... ArgTs>
1402#if !defined(DOXYGEN_ONLY)
1403 template <
typename F>
1405 template <
typename F,
typename A>
1406 friend class UserAllocatedEvent;
1411 template <
typename F>
1412 static void function_call(
void *p)
1417 template <
typename F>
1418 static void function_dtor(
void *p)
1424 template <
typename F,
typename... ContextArgTs>
1427 template <
typename F>
1431 constexpr context(F f)
1434 template <
typename... ArgTs>
1435 void operator()(ArgTs... args)
1441 template <
typename F,
typename C0>
1442 struct context<F, C0> {
1446 constexpr context(F f, C0 c0)
1449 template <
typename... ArgTs>
1450 void operator()(ArgTs... args)
1456 template <
typename F,
typename C0,
typename C1>
1457 struct context<F, C0, C1> {
1462 constexpr context(F f, C0 c0, C1 c1)
1463 : f(f), c0(c0), c1(c1) {}
1465 template <
typename... ArgTs>
1466 void operator()(ArgTs... args)
1472 template <
typename F,
typename C0,
typename C1,
typename C2>
1473 struct context<F, C0, C1, C2> {
1479 constexpr context(F f, C0 c0, C1 c1, C2 c2)
1480 : f(f), c0(c0), c1(c1), c2(c2) {}
1482 template <
typename... ArgTs>
1483 void operator()(ArgTs... args)
1485 f(c0, c1, c2, args...);
1489 template <
typename F,
typename C0,
typename C1,
typename C2,
typename C3>
1490 struct context<F, C0, C1, C2, C3> {
1497 constexpr context(F f, C0 c0, C1 c1, C2 c2, C3 c3)
1498 : f(f), c0(c0), c1(c1), c2(c2), c3(c3) {}
1500 template <
typename... ArgTs>
1501 void operator()(ArgTs... args)
1503 f(c0, c1, c2, c3, args...);
1507 template <
typename F,
typename C0,
typename C1,
typename C2,
typename C3,
typename C4>
1508 struct context<F, C0, C1, C2, C3, C4> {
1516 constexpr context(F f, C0 c0, C1 c1, C2 c2, C3 c3, C4 c4)
1517 : f(f), c0(c0), c1(c1), c2(c2), c3(c3), c4(c4) {}
1519 template <
typename... ArgTs>
1520 void operator()(ArgTs... args)
1522 f(c0, c1, c2, c3, c4, args...);
int call_in(duration ms, T *obj, R(T::*method)(ArgTs ...args), ArgTs ...args)
Calls an event on the queue after a specified delay.
void dispatch_once()
Dispatch currently queued events only and then terminate.
void break_dispatch()
Break out of a running event loop.
unsigned tick()
Millisecond counter.
void dispatch_forever()
Dispatch events without a timeout.
void dispatch_for(duration ms)
Dispatch events.
void dispatch(int ms=-1)
Dispatch events.
int call_every(duration ms, F f, ArgTs ...args)
Calls an event on the queue periodically.
~EventQueue()
Destroy an EventQueue.
int time_left(UserAllocatedEvent< F, A > *event)
Query how much time is left for delayed UserAllocatedEvent.
EventQueue(unsigned size=(32 *(EQUEUE_EVENT_SIZE - 2 *sizeof(void *)+sizeof(mbed::Callback< void()>))), unsigned char *buffer=NULL)
Create an EventQueue.
Event< void(ArgTs...)> event(R(*func)(BoundArgTs..., ArgTs...), ContextArgTs ...context_args)
Creates an event bound to the event queue.
int call(F f, Args ...args)
Calls an event on the queue.
int chain(EventQueue *target)
Chain an event queue onto another event queue.
bool cancel(int id)
Cancel an in-flight event.
int call_every(duration ms, T *obj, R(T::*method)(ArgTs ...args), ArgTs ...args)
Calls an event on the queue periodically.
int call_in(duration ms, F f, ArgTs ...args)
Calls an event on the queue after a specified delay.
Event< void(ArgTs...)> event(T *obj, R(T::*method)(BoundArgTs..., ArgTs...), ContextArgTs ...context_args)
Creates an event bound to the event queue.
void background(mbed::Callback< void(int)> update)
Background an event queue onto a single-shot timer-interrupt.
int time_left(int id)
Query how much time is left for delayed event.
Event< void(ArgTs...)> event(mbed::Callback< R(BoundArgTs..., ArgTs...)> cb, ContextArgTs ...context_args)
Creates an event bound to the event queue.
int call(T *obj, R(T::*method)(Args ...args), Args ...args)
Calls an event on the queue.
Callback class based on template specialization.
Prevents generation of copy constructor and copy assignment operator in derived classes.
#define EVENTS_QUEUE_SIZE
EVENTS_QUEUE_SIZE Default size of buffer for events.
UserAllocatedEvent< F, void(ArgTs...)> make_user_allocated_event(F f, ArgTs... args)
Creates an user allocated event bound to the event queue.