diff options
author | Max Kellermann <max@musicpd.org> | 2016-09-04 15:11:01 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-09-04 15:15:11 +0200 |
commit | 12091fcfb17b7f0b3b118ee46ce880fbc32f5e66 (patch) | |
tree | 09a262cc5bd1cc1bb1573d7301802eb313764c7f /src/thread/Util.cxx | |
parent | 5598826eaf61f6c9a1ab3e04e1ecb4b1c08af2c5 (diff) |
thread/Util: throw exception on error
Diffstat (limited to 'src/thread/Util.cxx')
-rw-r--r-- | src/thread/Util.cxx | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/thread/Util.cxx b/src/thread/Util.cxx index 1a01c298b..25301f432 100644 --- a/src/thread/Util.cxx +++ b/src/thread/Util.cxx @@ -27,9 +27,8 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" #include "Util.hxx" -#include "util/Error.hxx" +#include "system/Error.hxx" #ifdef __linux__ #include <sched.h> @@ -77,8 +76,8 @@ SetThreadIdlePriority() #endif }; -bool -SetThreadRealtime(Error& error) +void +SetThreadRealtime() { #ifdef __linux__ struct sched_param sched_param; @@ -89,13 +88,7 @@ SetThreadRealtime(Error& error) policy |= SCHED_RESET_ON_FORK; #endif - if(sched_setscheduler(0, policy, &sched_param)==0) { - return true; - } else { - error.FormatErrno("sched_setscheduler failed"); - return false; - } -#else - return true; // on non-linux systems, we pretend it worked + if (sched_setscheduler(0, policy, &sched_param) < 0) + throw MakeErrno("sched_setscheduler failed"); #endif // __linux__ }; |