diff --git a/src/xenia/base/threading.h b/src/xenia/base/threading.h index a145c3830..26e5267bf 100644 --- a/src/xenia/base/threading.h +++ b/src/xenia/base/threading.h @@ -402,6 +402,7 @@ class Timer : public WaitHandle { virtual bool Cancel() = 0; }; +#if XE_PLATFORM_WINDOWS struct ThreadPriority { static const int32_t kLowest = -2; static const int32_t kBelowNormal = -1; @@ -409,6 +410,15 @@ struct ThreadPriority { static const int32_t kAboveNormal = 1; static const int32_t kHighest = 2; }; +#else +struct ThreadPriority { + static const int32_t kLowest = 1; + static const int32_t kBelowNormal = 8; + static const int32_t kNormal = 16; + static const int32_t kAboveNormal = 24; + static const int32_t kHighest = 32; +}; +#endif // Models a Win32-like thread object. // https://msdn.microsoft.com/en-us/library/windows/desktop/ms682453(v=vs.85).aspx diff --git a/src/xenia/base/threading_posix.cc b/src/xenia/base/threading_posix.cc index f72f72d6f..733592800 100644 --- a/src/xenia/base/threading_posix.cc +++ b/src/xenia/base/threading_posix.cc @@ -27,6 +27,8 @@ #include #include +#include "logging.h" + #if XE_PLATFORM_ANDROID #include @@ -660,8 +662,18 @@ class PosixCondition : public PosixConditionBase { WaitStarted(); sched_param param{}; param.sched_priority = new_priority; - if (pthread_setschedparam(thread_, SCHED_FIFO, ¶m) != 0) - assert_always(); + int res = pthread_setschedparam(thread_, SCHED_FIFO, ¶m); + if (res != 0) { + switch (res) { + case EPERM: + XELOGW("Permission denied while setting priority"); + break; + case EINVAL: + assert_always(); + default: + XELOGW("Unknown error while setting priority"); + } + } } void QueueUserCallback(std::function callback) {