We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

thread priority

joshhsoj
joshhsoj asked
on
Medium Priority
266 Views
Last Modified: 2013-11-20
how can I change the priority that my program is running at?  I can't seem to find anything like ChangeThreadPriority.  thx
Comment
Watch Question

I think the function you want is SetThreadPriority.  Does that do what you want?

Commented:
BOOL SetThreadPriority( HANDLE hThread,
 // handle to the thread
 int nPriority
 // thread priority level  );
hThread is the return value which is returned by CretateThread

nPriority can be one of these values:
THREAD_PRIORITY_ABOVE_NORMAL
 Indicates 1 point above normal priority for the priority class.
 
THREAD_PRIORITY_BELOW_NORMAL
 Indicates 1 point below normal priority for the priority class.
 
THREAD_PRIORITY_HIGHEST
 Indicates 2 points above normal priority for the priority class.
 
THREAD_PRIORITY_IDLE
 Indicates a base priority level of 1 for IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority level of 16 for REALTIME_PRIORITY_CLASS processes.
 
THREAD_PRIORITY_LOWEST
 Indicates 2 points below normal priority for the priority class.
 
THREAD_PRIORITY_NORMAL
 Indicates normal priority for the priority class.
 
THREAD_PRIORITY_TIME_CRITICAL
 Indicates a base priority level of 15 for IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority level of 31 for REALTIME_PRIORITY_CLASS processes.
 
if you want to set the process priority
you must set the proper priority when you create the process,
when the process is created, you only can change thread priority of the process.
the thread handle of process is returned when you create the process and put in the structure.
LPPROCESS_INFORMATION lpProcessInformation


Author

Commented:
directed at wyy_cq: your answer is a good one, but to be fare, i would like to award the pts to "threshar_shark"  how do i do that?
josh - To open the question for someone else, reject the current proposed answer.  Then I can answer and you can give me a grade.  If you need any further help, please don't hesitate to ask.

Author

Commented:
ok
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Commented:
TO : thresher_shark
my answer is not for point only.
Helping each other is the most important.


Looks like josh accepted my answer anyway, I am glad you have that philosophy wyy_cq.  An unfortunate number of people are in it just for the points (which are essentially worthless).
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.