2 This file is part of PulseAudio.
4 PulseAudio is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2.1 of the License,
7 or (at your option) any later version.
9 PulseAudio is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with PulseAudio; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 #include <pulsecore/log.h>
28 #include <pulsecore/rtpoll.h>
30 static int before(pa_rtpoll_item
*i
) {
35 static void after(pa_rtpoll_item
*i
) {
39 static int worker(pa_rtpoll_item
*w
) {
44 int main(int argc
, char *argv
[]) {
46 pa_rtpoll_item
*i
, *w
;
47 struct pollfd
*pollfd
;
51 i
= pa_rtpoll_item_new(p
, PA_RTPOLL_EARLY
, 1);
52 pa_rtpoll_item_set_before_callback(i
, before
);
53 pa_rtpoll_item_set_after_callback(i
, after
);
55 pollfd
= pa_rtpoll_item_get_pollfd(i
, NULL
);
57 pollfd
->events
= POLLIN
;
59 w
= pa_rtpoll_item_new(p
, PA_RTPOLL_NORMAL
, 0);
60 pa_rtpoll_item_set_before_callback(w
, worker
);
62 pa_rtpoll_set_timer_relative(p
, 10000000); /* 10 s */
66 pa_rtpoll_item_free(i
);
68 i
= pa_rtpoll_item_new(p
, PA_RTPOLL_EARLY
, 1);
69 pa_rtpoll_item_set_before_callback(i
, before
);
70 pa_rtpoll_item_set_after_callback(i
, after
);
72 pollfd
= pa_rtpoll_item_get_pollfd(i
, NULL
);
74 pollfd
->events
= POLLIN
;
78 pa_rtpoll_item_free(i
);
80 pa_rtpoll_item_free(w
);