Solved

thread priority

Posted on 1998-11-19
8
240 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 122
Folder Comparison 12 53
Expand macro to ask for filename column 8 36
ffmpeg - "rtsp://...... Operation not permitted" 4 73
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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…
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.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now