?
Solved

Set my thread's importance...

Posted on 2006-06-28
6
Medium Priority
?
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 4

Assisted Solution

by:e_tadeu
e_tadeu earned 1600 total points
ID: 17002397
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 400 total points
ID: 17002424
If you using vc++ then do this

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

Author Comment

by:strickdd
ID: 17002464
Which priority is higher?  THREAD_PRIORITY_TIME_CRITICAL or THREAD_PRIORITY_HIGHEST?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 28

Author Comment

by:strickdd
ID: 17002549
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
ID: 17002602
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
ID: 17002611
yeah, i found that out:) I locked up my computer for a few seconds:)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

719 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