Mbed OS Reference
Loading...
Searching...
No Matches

Modules

 Event classes
 
 EventQueue class
 

Data Structures

struct  equeue_event
 
struct  equeue
 
class  Event< F >
 Event. More...
 
class  UserAllocatedEvent< F, A >
 

Macros

#define EVENTS_EVENT_SIZE    (EQUEUE_EVENT_SIZE - 2*sizeof(void*) + sizeof(mbed::Callback<void()>))
 EVENTS_EVENT_SIZE Minimum size of an event This size fits a Callback<void()> at minimum. More...
 
#define EVENTS_QUEUE_SIZE   (32*EVENTS_EVENT_SIZE)
 EVENTS_QUEUE_SIZE Default size of buffer for events. More...
 

Functions

events::EventQueuembed_event_queue ()
 Return a pointer to an EventQueue, on which normal tasks can be queued. More...
 

Detailed Description

Macro Definition Documentation

◆ EVENTS_EVENT_SIZE

#define EVENTS_EVENT_SIZE    (EQUEUE_EVENT_SIZE - 2*sizeof(void*) + sizeof(mbed::Callback<void()>))

EVENTS_EVENT_SIZE Minimum size of an event This size fits a Callback<void()> at minimum.

Definition at line 39 of file EventQueue.h.

◆ EVENTS_QUEUE_SIZE

#define EVENTS_QUEUE_SIZE   (32*EVENTS_EVENT_SIZE)

EVENTS_QUEUE_SIZE Default size of buffer for events.

Definition at line 45 of file EventQueue.h.

Function Documentation

◆ mbed_event_queue()

events::EventQueue * mbed_event_queue ( )

Return a pointer to an EventQueue, on which normal tasks can be queued.

All calls to this return the same EventQueue - it and its dispatch thread are created on the first call to this function. The dispatch thread runs at default priority (currently osPriorityNormal).

The EventQueue returned may be used to call() Events, or to chain() other EventQueues so that they are run in the same context.

Events (or chained EventQueues) executing on the normal event queue should normally take less than 10ms to execute, to avoid starving other users. As such, users can expect that event latency will typically be 10ms or less, but could occasionally be significantly higher if many events are queued.

If an RTOS is not present or the configuration option events.shared-dispatch-from-application is set to true, then this does not create a dedicated dispatch thread - instead the application is expected to run the EventQueue's dispatch, for example from main. This is necessary for the event loop to work without an RTOS, or an RTOS system can save memory by reusing the main stack.

Note
mbed_event_queue is not itself IRQ safe. To use the mbed_event_queue in interrupt context, you must first call mbed_event_queue() in threaded context and store the pointer for later use.
Returns
pointer to event queue