|
PulseAudio 17.0
|
A minimal main loop implementation based on the C library's poll() function. More...
Go to the source code of this file.
Typedefs | |
| typedef struct pa_mainloop | pa_mainloop |
| An opaque main loop object. | |
| typedef int(*) | pa_poll_func(struct pollfd *ufds, unsigned long nfds, int timeout, void *userdata) |
| Generic prototype of a poll() like function. | |
Functions | |
| pa_mainloop * | pa_mainloop_new (void) |
| Allocate a new main loop object. | |
| void | pa_mainloop_free (pa_mainloop *m) |
| Free a main loop object. | |
| int | pa_mainloop_prepare (pa_mainloop *m, int timeout) |
| Prepare for a single iteration of the main loop. | |
| int | pa_mainloop_poll (pa_mainloop *m) |
| Execute the previously prepared poll. | |
| int | pa_mainloop_dispatch (pa_mainloop *m) |
| Dispatch timeout, io and deferred events from the previously executed poll. | |
| int | pa_mainloop_get_retval (const pa_mainloop *m) |
| Return the return value as specified with the main loop's quit() routine. | |
| int | pa_mainloop_iterate (pa_mainloop *m, int block, int *retval) |
| Run a single iteration of the main loop. | |
| int | pa_mainloop_run (pa_mainloop *m, int *retval) |
| Run unlimited iterations of the main loop object until the main loop's quit() routine is called. | |
| pa_mainloop_api * | pa_mainloop_get_api (pa_mainloop *m) |
| Return the abstract main loop abstraction layer vtable for this main loop. | |
| void | pa_mainloop_quit (pa_mainloop *m, int retval) |
| Shutdown the main loop with the specified return value. | |
| void | pa_mainloop_wakeup (pa_mainloop *m) |
| Interrupt a running poll (for threaded systems). | |
| void | pa_mainloop_set_poll_func (pa_mainloop *m, pa_poll_func poll_func, void *userdata) |
| Change the poll() implementation. | |
A minimal main loop implementation based on the C library's poll() function.
Using the routines defined herein you may create a simple main loop supporting the generic main loop abstraction layer as defined in mainloop-api.h. This implementation is thread safe as long as you access the main loop object from a single thread only.
See also Main Loop
| typedef struct pa_mainloop pa_mainloop |
An opaque main loop object.
| typedef int(*) pa_poll_func(struct pollfd *ufds, unsigned long nfds, int timeout, void *userdata) |
Generic prototype of a poll() like function.
| int pa_mainloop_dispatch | ( | pa_mainloop * | m | ) |
Dispatch timeout, io and deferred events from the previously executed poll.
Returns a negative value on error. On success returns the number of source dispatched.
References pa_mainloop_dispatch().
Referenced by pa_mainloop_dispatch().
| void pa_mainloop_free | ( | pa_mainloop * | m | ) |
| pa_mainloop_api * pa_mainloop_get_api | ( | pa_mainloop * | m | ) |
Return the abstract main loop abstraction layer vtable for this main loop.
No need to free the API as it is owned by the loop and is destroyed when the loop is freed.
References pa_mainloop_get_api().
Referenced by pa_mainloop_get_api().
| int pa_mainloop_get_retval | ( | const pa_mainloop * | m | ) |
Return the return value as specified with the main loop's quit() routine.
References pa_mainloop_get_retval().
Referenced by pa_mainloop_get_retval().
| int pa_mainloop_iterate | ( | pa_mainloop * | m, |
| int | block, | ||
| int * | retval ) |
Run a single iteration of the main loop.
This is a convenience function for pa_mainloop_prepare(), pa_mainloop_poll() and pa_mainloop_dispatch(). Returns a negative value on error or exit request. If block is nonzero, block for events if none are queued. Optionally return the return value as specified with the main loop's quit() routine in the integer variable retval points to. On success returns the number of sources dispatched in this iteration.
References pa_mainloop_iterate().
Referenced by pa_mainloop_iterate().
| pa_mainloop * pa_mainloop_new | ( | void | ) |
Allocate a new main loop object.
Free with pa_mainloop_free.
References pa_mainloop_new().
Referenced by pa_mainloop_new().
| int pa_mainloop_poll | ( | pa_mainloop * | m | ) |
Execute the previously prepared poll.
Returns a negative value on error.
References pa_mainloop_poll().
Referenced by pa_mainloop_poll().
| int pa_mainloop_prepare | ( | pa_mainloop * | m, |
| int | timeout ) |
Prepare for a single iteration of the main loop.
Returns a negative value on error or exit request. timeout specifies a maximum timeout for the subsequent poll, or -1 for blocking behaviour. The timeout is specified in microseconds.
References pa_mainloop_prepare().
Referenced by pa_mainloop_prepare().
| void pa_mainloop_quit | ( | pa_mainloop * | m, |
| int | retval ) |
Shutdown the main loop with the specified return value.
References pa_mainloop_quit().
Referenced by pa_mainloop_quit().
| int pa_mainloop_run | ( | pa_mainloop * | m, |
| int * | retval ) |
Run unlimited iterations of the main loop object until the main loop's quit() routine is called.
Returns a negative value on error. Optionally return the return value as specified with the main loop's quit() routine in the integer variable retval points to.
References pa_mainloop_run().
Referenced by pa_mainloop_run().
| void pa_mainloop_set_poll_func | ( | pa_mainloop * | m, |
| pa_poll_func | poll_func, | ||
| void * | userdata ) |
Change the poll() implementation.
References pa_mainloop_set_poll_func().
Referenced by pa_mainloop_set_poll_func().
| void pa_mainloop_wakeup | ( | pa_mainloop * | m | ) |
Interrupt a running poll (for threaded systems).
References pa_mainloop_wakeup().
Referenced by pa_mainloop_wakeup().