X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=os%2Fwindows%2Fposix.c;h=bbd93e979522e098d9a438e0ccfdc10da0b89ec0;hp=3388127821acadc5d4053689f1246efd3be96af3;hb=24a2bb13ec8e449fd5e30967420894f88cdad11a;hpb=d23ae82785f99927331e358d2c0deac5e53f2df1 diff --git a/os/windows/posix.c b/os/windows/posix.c index 33881278..bbd93e97 100755 --- a/os/windows/posix.c +++ b/os/windows/posix.c @@ -647,10 +647,19 @@ int setgid(gid_t gid) int nice(int incr) { - if (incr != 0) { - errno = EINVAL; - return -1; - } + DWORD prioclass = NORMAL_PRIORITY_CLASS; + + if (incr < -15) + prioclass = HIGH_PRIORITY_CLASS; + else if (incr < 0) + prioclass = ABOVE_NORMAL_PRIORITY_CLASS; + else if (incr > 15) + prioclass = IDLE_PRIORITY_CLASS; + else if (incr > 0) + prioclass = BELOW_NORMAL_PRIORITY_CLASS; + + if (!SetPriorityClass(GetCurrentProcess(), prioclass)) + log_err("fio: SetPriorityClass failed\n"); return 0; }