diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:57:46 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:57:46 +0200 |
commit | ad4e3d2c55e75193c41356c23619f80add41db18 (patch) | |
tree | dd836d120f50e472106e04968ef8185c25e4242e /zen/process_priority.cpp | |
parent | 7.4 (diff) | |
download | FreeFileSync-ad4e3d2c55e75193c41356c23619f80add41db18.tar.gz FreeFileSync-ad4e3d2c55e75193c41356c23619f80add41db18.tar.bz2 FreeFileSync-ad4e3d2c55e75193c41356c23619f80add41db18.zip |
7.5
Diffstat (limited to 'zen/process_priority.cpp')
-rw-r--r-- | zen/process_priority.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/zen/process_priority.cpp b/zen/process_priority.cpp index 577e33a6..017eaa8b 100644 --- a/zen/process_priority.cpp +++ b/zen/process_priority.cpp @@ -41,7 +41,7 @@ struct ScheduleForBackgroundProcessing::Pimpl {}; ScheduleForBackgroundProcessing::ScheduleForBackgroundProcessing() { if (!::SetPriorityClass(::GetCurrentProcess(), PROCESS_MODE_BACKGROUND_BEGIN)) //this call lowers CPU priority, too!! - throwFileError(_("Cannot change process I/O priorities."), L"SetPriorityClass", getLastError()); + THROW_LAST_FILE_ERROR(_("Cannot change process I/O priorities."), L"SetPriorityClass"); } @@ -64,32 +64,32 @@ ScheduleForBackgroundProcessing::~ScheduleForBackgroundProcessing() {}; /* struct ScheduleForBackgroundProcessing { - - required functions ioprio_get/ioprio_set are not part of glibc: http://linux.die.net/man/2/ioprio_set - - and probably never will: http://sourceware.org/bugzilla/show_bug.cgi?id=4464 - - /usr/include/linux/ioprio.h not available on Ubuntu, so we can't use it instead - - ScheduleForBackgroundProcessing() : oldIoPrio(getIoPriority(IOPRIO_WHO_PROCESS, ::getpid())) - { - if (oldIoPrio != -1) - setIoPriority(::getpid(), IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0)); - } - ~ScheduleForBackgroundProcessing() - { - if (oldIoPrio != -1) - setIoPriority(::getpid(), oldIoPrio); - } + - required functions ioprio_get/ioprio_set are not part of glibc: http://linux.die.net/man/2/ioprio_set + - and probably never will: http://sourceware.org/bugzilla/show_bug.cgi?id=4464 + - /usr/include/linux/ioprio.h not available on Ubuntu, so we can't use it instead + + ScheduleForBackgroundProcessing() : oldIoPrio(getIoPriority(IOPRIO_WHO_PROCESS, ::getpid())) + { + if (oldIoPrio != -1) + setIoPriority(::getpid(), IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0)); + } + ~ScheduleForBackgroundProcessing() + { + if (oldIoPrio != -1) + setIoPriority(::getpid(), oldIoPrio); + } private: - static int getIoPriority(pid_t pid) - { - return ::syscall(SYS_ioprio_get, IOPRIO_WHO_PROCESS, pid); - } - static int setIoPriority(pid_t pid, int ioprio) - { - return ::syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, pid, ioprio); - } - - const int oldIoPrio; + static int getIoPriority(pid_t pid) + { + return ::syscall(SYS_ioprio_get, IOPRIO_WHO_PROCESS, pid); + } + static int setIoPriority(pid_t pid, int ioprio) + { + return ::syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, pid, ioprio); + } + + const int oldIoPrio; }; */ #endif |