mmr_event_arm()

Set a sigevent to deliver when a new event becomes available

Synopsis:

#include <mm/renderer/events.h>
int mmr_event_arm( mmr_context_t *ctxt, struct sigevent const *sev )

Arguments:

ctxt

A context handle.

sev

A sigevent to send; set to NULL to disarm.

Library:

mmrndclient

Description:

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 must call mmr_event_arm() repeatedly if you want to receive a sigevent for each mm-renderer event that occurs. The function is non-blocking because although it enables notification of an event, it doesn't wait for the event to occur.

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().

Returns:

A positive number if the sigevent isn't armed, zero on success, or -1 on failure (check errno).

Classification:

QNX Neutrino

Safety:  
Interrupt handler No
Signal handler No
Thread No, except when using different context handles