From 37a4a4075ebea976ccd2d36dba0ea295d049ea39 Mon Sep 17 00:00:00 2001 From: Yuval Langer Date: Sun, 3 Apr 2016 02:20:07 +0300 Subject: [PATCH] Fix NetBSD thread scheduling problem. Defining thread priority for SCHED_OTHER is implementation defined. Some platforms like NetBSD cannot reassign it as they are dynamic. Credit goes to and for finding this solution. --- src/thread.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/thread.cpp b/src/thread.cpp index 2b54ae22..09965d0b 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -138,6 +138,10 @@ void zmq::thread_t::setSchedulingParameters(int priority_, int schedulingPolicy_ policy = schedulingPolicy_; } +#ifdef __NetBSD__ + if(policy == SCHED_OTHER) param.sched_priority = -1; +#endif + rc = pthread_setschedparam(descriptor, policy, ¶m); posix_assert (rc); #endif