thread/Util: throw exception on error

This commit is contained in:
Max Kellermann
2016-09-04 15:11:01 +02:00
parent 5598826eaf
commit 12091fcfb1
3 changed files with 17 additions and 23 deletions
+8 -5
View File
@@ -40,6 +40,8 @@
#include "Log.hxx"
#include "Compiler.h"
#include <stdexcept>
#include <assert.h>
#include <string.h>
@@ -597,12 +599,13 @@ AudioOutput::Task()
{
FormatThreadName("output:%s", name);
Error error;
if(!SetThreadRealtime(error)) {
LogError(error);
LogWarning(output_domain,
"OutputThread could not get realtime scheduling, continuing anyway");
try {
SetThreadRealtime();
} catch (const std::runtime_error &e) {
LogError(e,
"OutputThread could not get realtime scheduling, continuing anyway");
}
SetThreadTimerSlackUS(100);
mutex.lock();