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

Dependents:   SimpleHTTPExample

Embed: (wiki syntax)

« Back to documentation index

EventLoop Class Reference

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:
priorityInitial priority of the thread (default: osPriorityNormal)
event_countNumber of events to allow enqueueing at once (default: 32)
event_contextMax size of arguments passed with an event (default: 0)
event_pointerPointer to memory area to be used for events (default: NULL)
stack_sizeStack size (in bytes) requirements for the thread (default: DEFAULT_STACK_SIZE)
stack_pointerPointer 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:
startTrue to start on construction
priorityInitial priority of the thread (default: osPriorityNormal)
event_countNumber of events to allow enqueueing at once (default: 32)
event_contextMax size of arguments passed with an event (default: 0)
event_pointerPointer to memory area to be used for events (default: NULL)
stack_sizeStack size (in bytes) requirements for the thread (default: DEFAULT_STACK_SIZE)
stack_pointerPointer 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:
msTime 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:
Tickto check
Trueif 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 ( 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 ( func,
A0  a0 
) [inherited]

Immediately post an event to the queue.

Definition at line 179 of file EventQueue.h.

bool trigger ( func ) [inherited]

Immediately post an event to the queue.

Definition at line 196 of file EventQueue.h.

bool trigger ( 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 ( 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 ( func,
A0  a0,
A1  a1 
) [inherited]

Immediately post an event to the queue.

Definition at line 162 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
A1  a1,
int  ms 
) [inherited]

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 376 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3,
int  ms 
) [inherited]

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 340 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3,
A4  a4,
int  ms 
) [inherited]

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 322 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
int  ms 
) [inherited]

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 394 of file EventQueue.h.

bool trigger_every ( func,
int  ms 
) [inherited]

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 412 of file EventQueue.h.

bool trigger_every ( func,
A0  a0,
A1  a1,
A2  a2,
int  ms 
) [inherited]

Post an event periodically.

Parameters:
msDelay in milliseconds

Definition at line 358 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3,
int  ms 
) [inherited]

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 232 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
A1  a1,
A2  a2,
int  ms 
) [inherited]

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 250 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
A1  a1,
int  ms 
) [inherited]

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 268 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
A1  a1,
A2  a2,
A3  a3,
A4  a4,
int  ms 
) [inherited]

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 214 of file EventQueue.h.

bool trigger_in ( func,
int  ms 
) [inherited]

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 304 of file EventQueue.h.

bool trigger_in ( func,
A0  a0,
int  ms 
) [inherited]

Post an event after a specified time.

Parameters:
msDelay in milliseconds

Definition at line 286 of file EventQueue.h.