Solved

Set my thread's importance...

Posted on 2006-06-28
6
199 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
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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

803 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