summaryrefslogtreecommitdiff
path: root/src/thread/Util.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-09-04 15:11:01 +0200
committerMax Kellermann <max@musicpd.org>2016-09-04 15:15:11 +0200
commit12091fcfb17b7f0b3b118ee46ce880fbc32f5e66 (patch)
tree09a262cc5bd1cc1bb1573d7301802eb313764c7f /src/thread/Util.cxx
parent5598826eaf61f6c9a1ab3e04e1ecb4b1c08af2c5 (diff)
thread/Util: throw exception on error
Diffstat (limited to 'src/thread/Util.cxx')
-rw-r--r--src/thread/Util.cxx17
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__
};