summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/rtclock.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-01-16 19:57:58 +0100
committerLennart Poettering <lennart@poettering.net>2009-01-16 19:57:58 +0100
commit5793f93350dd8f29b7bc97eb1ad38873e4ecebde (patch)
tree43bfb09d3b77ffb672c0969d71753aaa976151f2 /src/pulsecore/rtclock.c
parent4a137637976360e94dfc304c291b3166b3c03970 (diff)
make use of PR_SET_TIMERSLACK
Diffstat (limited to 'src/pulsecore/rtclock.c')
-rw-r--r--src/pulsecore/rtclock.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pulsecore/rtclock.c b/src/pulsecore/rtclock.c
index f33de830..5fc6da2b 100644
--- a/src/pulsecore/rtclock.c
+++ b/src/pulsecore/rtclock.c
@@ -27,9 +27,12 @@
#include <stddef.h>
#include <time.h>
#include <sys/time.h>
+#include <sys/prctl.h>
+#include <errno.h>
#include <pulse/timeval.h>
#include <pulsecore/macro.h>
+#include <pulsecore/core-error.h>
#include "rtclock.h"
@@ -89,6 +92,29 @@ pa_bool_t pa_rtclock_hrtimer(void) {
#endif
}
+void pa_rtclock_hrtimer_enable(void) {
+#ifdef PR_SET_TIMERSLACK
+ int slack_ns;
+
+ if ((slack_ns = prctl(PR_GET_TIMERSLACK, 0, 0, 0, 0)) < 0) {
+ pa_log_info("PR_GET_TIMERSLACK/PR_SET_TIMERSLACK not supported.");
+ return;
+ }
+
+ pa_log_debug("Timer slack set to %i us.", slack_ns/1000);
+
+ slack_ns = 500000000;
+
+ pa_log_debug("Setting timer slack to %i us.", slack_ns/1000);
+
+ if (prctl(PR_SET_TIMERSLACK, slack_ns, 0, 0, 0) < 0) {
+ pa_log_warn("PR_SET_TIMERSLACK failed: %s", pa_cstrerror(errno));
+ return;
+ }
+
+#endif
+}
+
pa_usec_t pa_rtclock_usec(void) {
struct timeval tv;