From 089cfcf15dde2ed1c08d3f3463f44fd6124c4ea6 Mon Sep 17 00:00:00 2001 From: sonarnerd Date: Tue, 24 Aug 2004 16:14:27 +0000 Subject: [PATCH] Tamper the scheduling priorities only when necessary. git-svn-id: svn+ssh://jackaudio.org/trunk/jack@741 0c269be4-1314-0410-8aa9-9f06e86f4224 --- drivers/oss/oss_driver.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/oss/oss_driver.c b/drivers/oss/oss_driver.c index 9761bf8..2bf7ea3 100644 --- a/drivers/oss/oss_driver.c +++ b/drivers/oss/oss_driver.c @@ -879,12 +879,20 @@ static void *io_thread (void *param) if (pthread_getschedparam(pthread_self(), &schedpol, &schedp) == 0) { - schedpol = SCHED_FIFO; - schedp.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1; - if (pthread_setschedparam(pthread_self(), schedpol, - &schedp) != 0) + if (schedpol != SCHED_FIFO) { - puts("oss_driver: pthread_setschedparam() failed\n"); + schedpol = SCHED_FIFO; + schedp.sched_priority = + sched_get_priority_max(SCHED_FIFO) - 1; + if (pthread_setschedparam(pthread_self(), schedpol, + &schedp) != 0) + { + puts("oss_driver: pthread_setschedparam() failed\n"); + } + } + else + { + puts("oss_driver: already running SCHED_FIFO; no changes\n"); } } else