mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-15 10:48:33 +01:00
set background thread priority on mac
This commit is contained in:
parent
1314ef2e37
commit
87b552d16d
@ -9,6 +9,9 @@
|
||||
#ifdef Q_OS_LINUX
|
||||
# include <sys/syscall.h>
|
||||
#endif
|
||||
#ifdef Q_OS_DARWIN
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
class BackgroundThreadBase : public QThread {
|
||||
Q_OBJECT
|
||||
@ -96,6 +99,8 @@ void BackgroundThread<T>::run() {
|
||||
int BackgroundThreadBase::ioprio_set(int which, int who, int ioprio) {
|
||||
#ifdef Q_OS_LINUX
|
||||
return syscall(SYS_ioprio_set, which, who, ioprio);
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
return setpriority(PRIO_DARWIN_THREAD, 0, ioprio == IOPRIO_CLASS_IDLE ? PRIO_DARWIN_BG : 0);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user