Maestro Audio Framework  v 1.0
NXP Semiconductors
osa_event.h File Reference

Contains timeout/event function prototypes for Impresario libosa. More...

Functions

int osa_timeout_create (OsaEvent *ev, osa_event_cb cb, void *arg)
 Create a timeout event. More...
 
int osa_timeout_start (OsaEvent *ev, const OsaTimeval *time)
 Start a timeout event. More...
 
int osa_timeout_cancel (OsaEvent *ev)
 Cancel a pending timeout event. More...
 
int osa_timeout_destroy (OsaEvent *ev)
 Destroy a timeout event object. More...
 

Function Documentation

◆ osa_timeout_create()

int osa_timeout_create ( OsaEvent ev,
osa_event_cb  cb,
void *  arg 
)

Create a timeout event object and associate it with the callback and callback argument. This will start a timer thread.

Parameters
evOutput parameter to store event object
cbCallback function for timer event object. Note that the callback function will be invoked from a separate thread on all platforms, so the writer of this should be careful when blocking or when using global data.
argArgument to be passed to callback function
Return values
ERRCODE_NO_ERRORSuccessfully created timeout event object.
ERRCODE_OUT_OF_MEMORYNo memory available.

◆ osa_timeout_start()

int osa_timeout_start ( OsaEvent ev,
const OsaTimeval *  time 
)

Initialize the event timeout object to invoke the callback after the specified amount of time. The time is relative to the current time, not absolute. Only one event will be triggered - the timer can be reset by calling osa_timeout_create() again.

Parameters
evValid event timeout object
timePointer to OsaTimeval object with relative time to invoke event callback.
Return values
ERRCODE_NO_ERRORSuccessfully created timeout event object.
ERRCODE_OUT_OF_MEMORYNo memory available.
ERRCODE_INVALID_ARGUMENTInvalid time or event timeout object.

◆ osa_timeout_cancel()

int osa_timeout_cancel ( OsaEvent ev)

Cancel a pending timeout event if the ev object points to a valid event that has been started.

Parameters
evValid event timeout object
Return values
ERRCODE_NO_ERRORSuccessfully created timeout event object.
ERRCODE_INVALID_ARGUMENTInvalid time or event timeout object.

◆ osa_timeout_destroy()

int osa_timeout_destroy ( OsaEvent ev)

Free the memory associated with a timeout event object and cancel all outstanding event notifications that may have been started. On Linux this function also causes the timer thread to exit if there are no outstanding event timer objects in the process.

Parameters
evValid event timeout object
Return values
ERRCODE_NO_ERRORSuccessfully created timeout event object.
ERRCODE_INVALID_ARGUMENTInvalid time or event timeout object.