diff options
author | Matthias Kretz <kretz@kde.org> | 2007-11-15 15:29:33 +0100 |
---|---|---|
committer | Matthias Kretz <kretz@kde.org> | 2007-11-15 15:29:33 +0100 |
commit | e4d811b726b85b7de83fafee24b5c1d05061bc1e (patch) | |
tree | beca10f4868540e03fde19228190be9d8d8e8d5b /src | |
parent | 0d62b545fbba787e72596fcc30177a6e8596a892 (diff) | |
download | xine-lib-e4d811b726b85b7de83fafee24b5c1d05061bc1e.tar.gz xine-lib-e4d811b726b85b7de83fafee24b5c1d05061bc1e.tar.bz2 |
using select instead of nanosleep the wakeup count reported by powertop is reduced by 50%
Diffstat (limited to 'src')
-rw-r--r-- | src/xine-utils/utils.c | 10 |
1 files changed, 10 insertions, 0 deletions
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 } |