Solved

thread priority

Posted on 1998-11-19
8
241 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
0
Comment
Question by:joshhsoj
  • 4
  • 2
  • 2
8 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324988
I think the function you want is SetThreadPriority.  Does that do what you want?
0
 
LVL 2

Expert Comment

by:wyy_cq
ID: 1324989
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


0
 

Author Comment

by:joshhsoj
ID: 1324990
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?
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324991
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.
0
 

Author Comment

by:joshhsoj
ID: 1324992
ok
0
 
LVL 6

Accepted Solution

by:
thresher_shark earned 100 total points
ID: 1324993
Okay, thanks, if you have any other questions, please feel free to ask.  Thanks!

wyy_cq - If you disagree with josh's decision to give me the points, please respond.
0
 
LVL 2

Expert Comment

by:wyy_cq
ID: 1324994
TO : thresher_shark
my answer is not for point only.
Helping each other is the most important.


0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324995
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).
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to calculate times for developing software? 8 67
Rewrite URL With Encoded Characters 6 78
MaxSpan challenge 9 96
Fibonacci challenge 11 124
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question