Change priority of the current process in C

前端 未结 3 1440
别那么骄傲
别那么骄傲 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:00

    @ allain

    Can you lower your own process' priority without being superuser?

    Sure. Be aware, however, that this is a one way street. You can't even get back to where you started. And even fairly small reductions in priority can have startlingly large effects on running time when there is significant load on the system.

提交回复
热议问题