mmr_event_wait()

Updated: April 19, 2023

Wait until an event is available

Synopsis:

#include <mm/renderer/events.h>
int mmr_event_wait(mmr_context_t *ctxt)

Arguments:

ctxt
A context handle

Library:

mmrndclient

Description:

Wait for an event. This function usually blocks until an event occurs, at which point it unblocks and you can call mmr_event_get() to get the event details.

Typically, you call mmr_event_wait() within an event-processing loop, right before calling mmr_event_get().

Note:

This function is thread-safe only when using different context handles in each call. It's neither interrupt handler-safe nor signal-handler safe.

Occasionally, mmr_event_wait() may unblock or not block at all even though no events are available. For example, suppose a track enters the playlist range but then exits soon afterwards. The mm-renderer service creates metadata for the track when it comes in range and this activity generates an event. If the track exits the playlist range before the application calls mmr_event_get(), the track's metadata and the corresponding event are deleted. In the subsequent call to mmr_event_get(), the function will return the MMR_EVENT_NONE event.

When you call mmr_event_wait(), it unregisters any event that mmr_event_arm() has registered and then registers its own.

Returns:

Zero on success, or -1 on failure (check errno).