Contains timeout/event function prototypes for Impresario libosa.
More...
◆ 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
-
ev | Output parameter to store event object |
cb | Callback 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. |
arg | Argument to be passed to callback function |
- Return values
-
ERRCODE_NO_ERROR | Successfully created timeout event object. |
ERRCODE_OUT_OF_MEMORY | No 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
-
ev | Valid event timeout object |
time | Pointer to OsaTimeval object with relative time to invoke event callback. |
- Return values
-
ERRCODE_NO_ERROR | Successfully created timeout event object. |
ERRCODE_OUT_OF_MEMORY | No memory available. |
ERRCODE_INVALID_ARGUMENT | Invalid time or event timeout object. |
◆ osa_timeout_cancel()
Cancel a pending timeout event if the ev object points to a valid event that has been started.
- Parameters
-
ev | Valid event timeout object |
- Return values
-
ERRCODE_NO_ERROR | Successfully created timeout event object. |
ERRCODE_INVALID_ARGUMENT | Invalid 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
-
ev | Valid event timeout object |
- Return values
-
ERRCODE_NO_ERROR | Successfully created timeout event object. |
ERRCODE_INVALID_ARGUMENT | Invalid time or event timeout object. |