Set a sigevent to deliver when a new event becomes available.
#include <mm/renderer/events.h>
int mmr_event_arm(mmr_context_t *ctxt,
struct sigevent const *sev)
BlackBerry 10.0.0
A context handle.
A sigevent to send; set to NULL to disarm.
Set a sigevent to deliver when a new mm-renderer event becomes available. The mmr_event_arm() function is helpful if your program already has an event-processing loop that uses signals or pulses as notifications and you simply want to add code that processes mm-renderer events. To do this, you must first call mmr_event_arm() to request notification of the next mm-renderer event. Then, in the new event-handling code, you must call mmr_event_get() to retrieve the event information.
Because mmr_event_arm() enables notification of only one event, you may want to call mmr_event_get() in a loop until it runs out of events to report and returns MMR_EVENT_NONE. Consider the following code snippet:
// Only arm after MMR_EVENT_NONE:
int havemore = 1;
do {
event = mmr__event_get(ctxt); // Error handling omitted
if ( event->type != MMR_EVENT_NONE ) {
process( event );
} else {
havemore = mmr_event_arm(ctxt, &sev); // Error handling omitted
}
} while ( havemore );
// We've processed all pending events, sev is armed
If mm-renderer already has an event waiting when you call mmr_event_arm(), the function doesn't arm a sigevent but immediately returns a value greater than zero. If you receive such a value, you must call mmr_event_get() and process the event.
Occasionally, the mmr_event_get() function can't retrieve any meaningful event data and instead returns the MMR_EVENT_NONE event. This can happen if the sigevent wasn't armed (because an event was already waiting) or if the sigevent was armed and then delivered by the system (because an event occurred after the last mmr_event_arm() call). For an example of a situation when MMR_EVENT_NONE might be returned, see mmr_event_wait().
A positive number if the sigevent isn't armed, 0 on success, or -1 on failure (check errno).