source: roaraudio/libroarpulse/mainloop.c @ 3461:d5cac3d3f9b6

Last change on this file since 3461:d5cac3d3f9b6 was 3461:d5cac3d3f9b6, checked in by phi, 14 years ago

prototype

File size: 3.7 KB
Line 
1//mainloop.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
5 *  The code (may) include prototypes and comments (and maybe
6 *  other code fragements) from libpulse*. They are mostly copyrighted by:
7 *  Lennart Poettering <poettering@users.sourceforge.net> and
8 *  Pierre Ossman <drzeus@drzeus.cx>
9 *
10 *  This file is part of libroarpulse a part of RoarAudio,
11 *  a cross-platform sound system for both, home and professional use.
12 *  See README for details.
13 *
14 *  This file is free software; you can redistribute it and/or modify
15 *  it under the terms of the GNU General Public License version 3
16 *  as published by the Free Software Foundation.
17 *
18 *  RoarAudio is distributed in the hope that it will be useful,
19 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 *  GNU General Public License for more details.
22 *
23 *  You should have received a copy of the GNU General Public License
24 *  along with this software; see the file COPYING.  If not, write to
25 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 *  NOTE for everyone want's to change something and send patches:
28 *  read README and HACKING! There a addition information on
29 *  the license of this document you need to read before you send
30 *  any patches.
31 *
32 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
33 *  or libpulse*:
34 *  The libs libroaresd, libroararts and libroarpulse link this libroar
35 *  and are therefore GPL. Because of this it may be illigal to use
36 *  them with any software that uses libesd, libartsc or libpulse*.
37 */
38
39#include <libroarpulse/libroarpulse.h>
40
41/** Allocate a new main loop object */
42pa_mainloop *pa_mainloop_new(void);
43
44/** Free a main loop object */
45void pa_mainloop_free(pa_mainloop* m);
46
47/** Prepare for a single iteration of the main loop. Returns a negative value
48on error or exit request. timeout specifies a maximum timeout for the subsequent
49poll, or -1 for blocking behaviour. .*/
50int pa_mainloop_prepare(pa_mainloop *m, int timeout);
51
52/** Execute the previously prepared poll. Returns a negative value on error.*/
53int pa_mainloop_poll(pa_mainloop *m);
54
55/** Dispatch timeout, io and deferred events from the previously executed poll. Returns
56a negative value on error. On success returns the number of source dispatched. */
57int pa_mainloop_dispatch(pa_mainloop *m);
58
59/** Return the return value as specified with the main loop's quit() routine. */
60int pa_mainloop_get_retval(pa_mainloop *m);
61
62/** Run a single iteration of the main loop. This is a convenience function
63for pa_mainloop_prepare(), pa_mainloop_poll() and pa_mainloop_dispatch().
64Returns a negative value on error or exit request. If block is nonzero,
65block for events if none are queued. Optionally return the return value as
66specified with the main loop's quit() routine in the integer variable retval points
67to. On success returns the number of sources dispatched in this iteration. */
68int pa_mainloop_iterate(pa_mainloop *m, int block, int *retval);
69
70/** Run unlimited iterations of the main loop object until the main loop's quit() routine is called. */
71int pa_mainloop_run(pa_mainloop *m, int *retval);
72
73/** Return the abstract main loop abstraction layer vtable for this main loop. */
74pa_mainloop_api* pa_mainloop_get_api(pa_mainloop*m);
75
76/** Shutdown the main loop */
77void pa_mainloop_quit(pa_mainloop *m, int r);
78
79/** Interrupt a running poll (for threaded systems) */
80void pa_mainloop_wakeup(pa_mainloop *m);
81
82/** Generic prototype of a poll() like function */
83typedef int (*pa_poll_func)(struct pollfd *ufds, unsigned long nfds, int timeout, void*userdata);
84
85/** Change the poll() implementation */
86void pa_mainloop_set_poll_func(pa_mainloop *m, pa_poll_func poll_func, void *userdata);
87
88//ll
Note: See TracBrowser for help on using the repository browser.