Solved

Set my thread's importance...

Posted on 2006-06-28
6
201 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 400 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 100 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

752 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