user1581390
user1581390

Reputation: 1998

C++\Win32 Running application/thread in low priority mode?

I'm using CreateThread for my threads.

One thread is taking a lot of cpu %, I need to have that reduced.

Yes, I know I can just call Sleep(), but in this case its complicated to implement.

How do I set the thread to run in low priority or if not possible, then how do I run my application in low priority?

Upvotes: 0

Views: 471

Answers (2)

dyasta
dyasta

Reputation: 2191

SetThreadPriority will set the priority of individual threads. Alternatively, as you asked, you can use SetPriorityClass to change the base priority of the process. It is this base priority, combined with thread priorities, from which the actual thread priority is derived.

Upvotes: 1

marcinj
marcinj

Reputation: 49986

Use SetThreadPriority function, for details search msdn

Upvotes: 1

Related Questions