From: Conor McCarthy cmccarthy@codeweavers.com
Not checking nice_limit here can result in some calls to setpriority() succeeding while others fail, which can result in relative priorities being incorrect. For example, buffer underflows can occur in winepulse.drv because the priority is too low in pulse_timer_loop(). --- server/thread.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/server/thread.c b/server/thread.c index 603bf2bd0a5..addb0292e5f 100644 --- a/server/thread.c +++ b/server/thread.c @@ -252,6 +252,9 @@ static void apply_thread_priority( struct thread *thread, int effective_priority { int min = -nice_limit, max = nice_limit, range = max - min, niceness;
+ if (nice_limit >= 0) + return; + /* FIXME: handle realtime priorities using SCHED_RR if possible */ if (effective_priority >= LOW_REALTIME_PRIORITY) effective_priority = LOW_REALTIME_PRIORITY - 1; /* map an NT application band [1,15] priority to [-nice_limit, nice_limit] */