diff options
Diffstat (limited to 'src/tests/mainloop-test.c')
| -rw-r--r-- | src/tests/mainloop-test.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/tests/mainloop-test.c b/src/tests/mainloop-test.c index b06d0ed1..ab23de43 100644 --- a/src/tests/mainloop-test.c +++ b/src/tests/mainloop-test.c @@ -1,18 +1,16 @@ -/* $Id$ */ - /*** This file is part of PulseAudio. - + PulseAudio is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2 of the License, + by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + PulseAudio is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with PulseAudio; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -28,10 +26,11 @@ #include <sys/time.h> #include <assert.h> +#include <pulse/rtclock.h> #include <pulse/timeval.h> #include <pulsecore/core-util.h> -#include <pulsecore/gccmacro.h> +#include <pulsecore/core-rtclock.h> #ifdef GLIB_MAIN_LOOP @@ -48,7 +47,7 @@ static pa_defer_event *de; static void iocb(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_event_flags_t f, void *userdata) { unsigned char c; - read(fd, &c, sizeof(c)); + pa_assert_se(read(fd, &c, sizeof(c)) >= 0); fprintf(stderr, "IO EVENT: %c\n", c < 32 ? '.' : c); a->defer_enable(de, 1); } @@ -68,7 +67,7 @@ static void tcb(pa_mainloop_api*a, pa_time_event *e, const struct timeval *tv, v #endif } -int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) { +int main(int argc, char *argv[]) { pa_mainloop_api *a; pa_io_event *ioe; pa_time_event *te; @@ -101,9 +100,7 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) { de = a->defer_new(a, dcb, NULL); assert(de); - pa_gettimeofday(&tv); - tv.tv_sec += 10; - te = a->time_new(a, &tv, tcb, NULL); + te = a->time_new(a, pa_timeval_rtstore(&tv, pa_rtclock_now() + 2 * PA_USEC_PER_SEC, TRUE), tcb, NULL); #if defined(GLIB_MAIN_LOOP) g_main_loop_run(glib_main_loop); @@ -121,6 +118,6 @@ int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char *argv[]) { #else pa_mainloop_free(m); #endif - + return 0; } |
