From e4d811b726b85b7de83fafee24b5c1d05061bc1e Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Thu, 15 Nov 2007 15:29:33 +0100 Subject: using select instead of nanosleep the wakeup count reported by powertop is reduced by 50% --- src/xine-utils/utils.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index fa0c11dbe..ab5d9a2ec 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -434,6 +434,7 @@ char *xine_chomp(char *str) { * a thread-safe usecond sleep */ void xine_usec_sleep(unsigned usec) { +#if 0 #if HAVE_NANOSLEEP /* nanosleep is prefered on solaris, because it's mt-safe */ struct timespec ts, remaining; @@ -449,6 +450,15 @@ void xine_usec_sleep(unsigned usec) { usleep(usec); # endif #endif +#else + if (usec < 10000) { + usec = 10000; + } + struct timeval tm; + tm.tv_sec = usec / 1000000; + tm.tv_usec = usec % 1000000; + select(0, 0, 0, 0, &tm); +#endif } -- cgit v1.2.3