Change priority of the current process in C

前端 未结 3 1439
别那么骄傲
别那么骄傲 2021-02-07 19:31

On Windows I can do:

HANDLE hCurrentProcess = GetCurrentProcess();

SetPriorityClass(hCurrentProcess, ABOVE_NORMAL_PRIORITY_CLASS);

How can I d

3条回答
  •  再見小時候
    2021-02-07 20:06

    Try:

    #include 
    #include 
    
    int main(){
        setpriority(PRIO_PROCESS, 0, -20);
    }
    

    Note that you must be running as superuser for this to work.

    (for more info, type 'man setpriority' at a prompt.)

提交回复
热议问题