Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
EventLoop Class Reference
Managed queue coupled with its own thread. More...
#include <EventLoop.h>
Inherits EventQueue.
Public Member Functions | |
| EventLoop (osPriority priority=osPriorityNormal, unsigned event_count=32, unsigned event_context=0, unsigned char *event_pointer=NULL, uint32_t stack_size=DEFAULT_STACK_SIZE, unsigned char *stack_pointer=NULL) | |
| Create an event loop without starting execution. | |
| EventLoop (bool start, osPriority priority=osPriorityNormal, unsigned event_count=32, unsigned event_context=0, unsigned char *event_pointer=NULL, uint32_t stack_size=DEFAULT_STACK_SIZE, unsigned char *stack_pointer=NULL) | |
| Create an event loop running in a dedicated thread. | |
| ~EventLoop () | |
| Clean up event loop. | |
| osStatus | start () |
| Starts an event loop running in a dedicated thread. | |
| osStatus | stop () |
| Stops an event loop cleanly, waiting for any currently executing events. | |
| void | dispatch (int ms=-1) |
| Dispatch pending events. | |
| unsigned | get_tick () |
| Get current tick of the event queue. | |
| bool | past_tick (unsigned tick) |
| Determine if tick has been passed. | |
| template<typename F , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 > | |
| bool | trigger (F func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) |
| Immediately post an event to the queue. | |
| template<typename F , typename A0 , typename A1 , typename A2 , typename A3 > | |
| bool | trigger (F func, A0 a0, A1 a1, A2 a2, A3 a3) |
| Immediately post an event to the queue. | |
| template<typename F , typename A0 , typename A1 , typename A2 > | |
| bool | trigger (F func, A0 a0, A1 a1, A2 a2) |
| Immediately post an event to the queue. | |
| template<typename F , typename A0 , typename A1 > | |
| bool | trigger (F func, A0 a0, A1 a1) |
| Immediately post an event to the queue. | |
| template<typename F , typename A0 > | |
| bool | trigger (F func, A0 a0) |
| Immediately post an event to the queue. | |
| template<typename F > | |
| bool | trigger (F func) |
| Immediately post an event to the queue. | |
| template<typename F , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 > | |
| bool | trigger_in (F func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, int ms) |
| Post an event after a specified time. | |
| template<typename F , typename A0 , typename A1 , typename A2 , typename A3 > | |
| bool | trigger_in (F func, A0 a0, A1 a1, A2 a2, A3 a3, int ms) |
| Post an event after a specified time. | |
| template<typename F , typename A0 , typename A1 , typename A2 > | |
| bool | trigger_in (F func, A0 a0, A1 a1, A2 a2, int ms) |
| Post an event after a specified time. | |
| template<typename F , typename A0 , typename A1 > | |
| bool | trigger_in (F func, A0 a0, A1 a1, int ms) |
| Post an event after a specified time. | |
| template<typename F , typename A0 > | |
| bool | trigger_in (F func, A0 a0, int ms) |
| Post an event after a specified time. | |
| template<typename F > | |
| bool | trigger_in (F func, int ms) |
| Post an event after a specified time. | |
| template<typename F , typename A0 , typename A1 , typename A2 , typename A3 , typename A4 > | |
| bool | trigger_every (F func, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, int ms) |
| Post an event periodically. | |
| template<typename F , typename A0 , typename A1 , typename A2 , typename A3 > | |
| bool | trigger_every (F func, A0 a0, A1 a1, A2 a2, A3 a3, int ms) |
| Post an event periodically. | |
| template<typename F , typename A0 , typename A1 , typename A2 > | |
| bool | trigger_every (F func, A0 a0, A1 a1, A2 a2, int ms) |
| Post an event periodically. | |
| template<typename F , typename A0 , typename A1 > | |
| bool | trigger_every (F func, A0 a0, A1 a1, int ms) |
| Post an event periodically. | |
| template<typename F , typename A0 > | |
| bool | trigger_every (F func, A0 a0, int ms) |
| Post an event periodically. | |
| template<typename F > | |
| bool | trigger_every (F func, int ms) |
| Post an event periodically. | |
Detailed Description
Managed queue coupled with its own thread.
Definition at line 13 of file EventLoop.h.
Constructor & Destructor Documentation
| EventLoop | ( | osPriority | priority = osPriorityNormal, |
| unsigned | event_count = 32, |
||
| unsigned | event_context = 0, |
||
| unsigned char * | event_pointer = NULL, |
||
| uint32_t | stack_size = DEFAULT_STACK_SIZE, |
||
| unsigned char * | stack_pointer = NULL |
||
| ) |
Create an event loop without starting execution.
- Parameters:
-
priority Initial priority of the thread (default: osPriorityNormal) event_count Number of events to allow enqueueing at once (default: 32) event_context Max size of arguments passed with an event (default: 0) event_pointer Pointer to memory area to be used for events (default: NULL) stack_size Stack size (in bytes) requirements for the thread (default: DEFAULT_STACK_SIZE) stack_pointer Pointer to stack area to be used by the thread (default: NULL)
Definition at line 5 of file EventLoop.cpp.
| EventLoop | ( | bool | start, |
| osPriority | priority = osPriorityNormal, |
||
| unsigned | event_count = 32, |
||
| unsigned | event_context = 0, |
||
| unsigned char * | event_pointer = NULL, |
||
| uint32_t | stack_size = DEFAULT_STACK_SIZE, |
||
| unsigned char * | stack_pointer = NULL |
||
| ) |
Create an event loop running in a dedicated thread.
- Parameters:
-
start True to start on construction priority Initial priority of the thread (default: osPriorityNormal) event_count Number of events to allow enqueueing at once (default: 32) event_context Max size of arguments passed with an event (default: 0) event_pointer Pointer to memory area to be used for events (default: NULL) stack_size Stack size (in bytes) requirements for the thread (default: DEFAULT_STACK_SIZE) stack_pointer Pointer to stack area to be used by the thread (default: NULL)
Definition at line 18 of file EventLoop.cpp.
| ~EventLoop | ( | ) |
Clean up event loop.
Definition at line 36 of file EventLoop.cpp.
Member Function Documentation
| void dispatch | ( | int | ms = -1 ) |
[inherited] |
Dispatch pending events.
- Parameters:
-
ms Time to wait for events in milliseconds, 0 indicates to return immediately if no events are pending
Definition at line 65 of file EventQueue.cpp.
| unsigned get_tick | ( | ) | [inherited] |
Get current tick of the event queue.
- Returns:
- Number of milliseconds since the queue was instantiated, this count intentionally overflows to 0 after 2^32-1
Definition at line 52 of file EventQueue.cpp.
| bool past_tick | ( | unsigned | tick ) | [inherited] |
Determine if tick has been passed.
- Parameters:
-
Tick to check True if tick has been passed
Definition at line 56 of file EventQueue.cpp.
| osStatus start | ( | ) |
Starts an event loop running in a dedicated thread.
Definition at line 40 of file EventLoop.cpp.
| osStatus stop | ( | ) |
Stops an event loop cleanly, waiting for any currently executing events.
Definition at line 54 of file EventLoop.cpp.
| bool trigger | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| A2 | a2, | ||
| A3 | a3 | ||
| ) | [inherited] |
Immediately post an event to the queue.
Definition at line 128 of file EventQueue.h.
| bool trigger | ( | F | func, |
| A0 | a0 | ||
| ) | [inherited] |
Immediately post an event to the queue.
Definition at line 179 of file EventQueue.h.
| bool trigger | ( | F | func ) | [inherited] |
Immediately post an event to the queue.
Definition at line 196 of file EventQueue.h.
| bool trigger | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| A2 | a2, | ||
| A3 | a3, | ||
| A4 | a4 | ||
| ) | [inherited] |
Immediately post an event to the queue.
Definition at line 111 of file EventQueue.h.
| bool trigger | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| A2 | a2 | ||
| ) | [inherited] |
Immediately post an event to the queue.
Definition at line 145 of file EventQueue.h.
| bool trigger | ( | F | func, |
| A0 | a0, | ||
| A1 | a1 | ||
| ) | [inherited] |
Immediately post an event to the queue.
Definition at line 162 of file EventQueue.h.
| bool trigger_every | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| int | ms | ||
| ) | [inherited] |
Post an event periodically.
- Parameters:
-
ms Delay in milliseconds
Definition at line 376 of file EventQueue.h.
| bool trigger_every | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| A2 | a2, | ||
| A3 | a3, | ||
| int | ms | ||
| ) | [inherited] |
Post an event periodically.
- Parameters:
-
ms Delay in milliseconds
Definition at line 340 of file EventQueue.h.
| bool trigger_every | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| A2 | a2, | ||
| A3 | a3, | ||
| A4 | a4, | ||
| int | ms | ||
| ) | [inherited] |
Post an event periodically.
- Parameters:
-
ms Delay in milliseconds
Definition at line 322 of file EventQueue.h.
| bool trigger_every | ( | F | func, |
| A0 | a0, | ||
| int | ms | ||
| ) | [inherited] |
Post an event periodically.
- Parameters:
-
ms Delay in milliseconds
Definition at line 394 of file EventQueue.h.
| bool trigger_every | ( | F | func, |
| int | ms | ||
| ) | [inherited] |
Post an event periodically.
- Parameters:
-
ms Delay in milliseconds
Definition at line 412 of file EventQueue.h.
| bool trigger_every | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| A2 | a2, | ||
| int | ms | ||
| ) | [inherited] |
Post an event periodically.
- Parameters:
-
ms Delay in milliseconds
Definition at line 358 of file EventQueue.h.
| bool trigger_in | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| A2 | a2, | ||
| A3 | a3, | ||
| int | ms | ||
| ) | [inherited] |
Post an event after a specified time.
- Parameters:
-
ms Delay in milliseconds
Definition at line 232 of file EventQueue.h.
| bool trigger_in | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| A2 | a2, | ||
| int | ms | ||
| ) | [inherited] |
Post an event after a specified time.
- Parameters:
-
ms Delay in milliseconds
Definition at line 250 of file EventQueue.h.
| bool trigger_in | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| int | ms | ||
| ) | [inherited] |
Post an event after a specified time.
- Parameters:
-
ms Delay in milliseconds
Definition at line 268 of file EventQueue.h.
| bool trigger_in | ( | F | func, |
| A0 | a0, | ||
| A1 | a1, | ||
| A2 | a2, | ||
| A3 | a3, | ||
| A4 | a4, | ||
| int | ms | ||
| ) | [inherited] |
Post an event after a specified time.
- Parameters:
-
ms Delay in milliseconds
Definition at line 214 of file EventQueue.h.
| bool trigger_in | ( | F | func, |
| int | ms | ||
| ) | [inherited] |
Post an event after a specified time.
- Parameters:
-
ms Delay in milliseconds
Definition at line 304 of file EventQueue.h.
| bool trigger_in | ( | F | func, |
| A0 | a0, | ||
| int | ms | ||
| ) | [inherited] |
Post an event after a specified time.
- Parameters:
-
ms Delay in milliseconds
Definition at line 286 of file EventQueue.h.
Generated on Wed Jul 13 2022 19:57:07 by
1.7.2