Solved

Set my thread's importance...

Posted on 2006-06-28
6
197 Views
Last Modified: 2010-04-01
I am looking to set my console applications thread to be of highest priority. How can I do this in C++?
0
Comment
Question by:strickdd
  • 3
  • 2
6 Comments
 
LVL 4

Assisted Solution

by:e_tadeu
e_tadeu earned 400 total points
Comment Utility
Use SetThreadPriority from the Windows API

http://windowssdk.msdn.microsoft.com/en-us/library/ms686277.aspx
0
 
LVL 12

Accepted Solution

by:
rajeev_devin earned 100 total points
Comment Utility
If you using vc++ then do this

SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
0
 
LVL 28

Author Comment

by:strickdd
Comment Utility
Which priority is higher?  THREAD_PRIORITY_TIME_CRITICAL or THREAD_PRIORITY_HIGHEST?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 28

Author Comment

by:strickdd
Comment Utility
Nevermind, i ran some time tests and over all, THREAD_PRIORITY_TIME_CRITICAL, is a higher priority.
0
 
LVL 4

Expert Comment

by:e_tadeu
Comment Utility
Take care setting a priority too high, because you can "lock" your entire system, even the mouse events on other applications (including explorer.exe) ;)
0
 
LVL 28

Author Comment

by:strickdd
Comment Utility
yeah, i found that out:) I locked up my computer for a few seconds:)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

744 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

13 Experts available now in Live!

Get 1:1 Help Now