4 This file is part of PulseAudio.
6 PulseAudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 PulseAudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with PulseAudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
32 #include <pulse/mainloop.h>
33 #include <pulsecore/gccmacro.h>
36 #include <pulse/mainloop-signal.h>
39 #include "../daemon/cpulimit.h"
41 /* A simple example for testing the cpulimit subsystem */
47 static void func(pa_mainloop_api
*m
, PA_GCC_UNUSED pa_signal_event
*e
, PA_GCC_UNUSED
int sig
, PA_GCC_UNUSED
void *userdata
) {
51 if ((now
- start
) >= 30) {
53 fprintf(stderr
, "Test failed\n");
60 int main(PA_GCC_UNUSED
int argc
, PA_GCC_UNUSED
char *argv
[]) {
63 m
= pa_mainloop_new();
66 pa_cpu_limit_init(pa_mainloop_get_api(m
));
71 pa_signal_init(pa_mainloop_get_api(m
));
72 pa_signal_new(SIGUSR1
, func
, NULL
);
74 pa_mainloop_run(m
, NULL
);
81 if ((now
- start
) >= 30) {
82 fprintf(stderr
, "Test failed\n");