CPU throttling in C++

后端 未结 5 809
半阙折子戏
半阙折子戏 2021-02-06 20:53

I was just wondering if there is an elegant way to set the maximum CPU load for a particular thread doing intensive calculations.

Right now I have located the most tim

5条回答
  •  自闭症患者
    2021-02-06 21:54

    I can't think of any cross platform way of what you want (or any guaranteed way full stop) but as you are using GetTickCount perhaps you aren't interested in cross platform :)

    I'd use interprocess communications and set the intensive processes nice levels to get what you require but I'm not sure that's appropriate for your situation.

    EDIT: I agree with Bernard which is why I think a process rather than a thread might be more appropriate but it just might not suit your purposes.

提交回复
热议问题