Solved

SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST)

Posted on 2009-04-09
3
1,165 Views
Last Modified: 2012-05-06
http://beta.experts-exchange.com/articles/Programming/Languages/.NET/Visual_Basic.NET/Upgrading-VB6-to-VB-NET-Performance-Improvements.html
Hi,
In the article mentioned above he has mentioned in doevents
 3.  Add 2 lines of code before the intensive processing begins to set the thread priority:

          SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST)
          SetPriorityClass(GetCurrentProcess, HIGH_PRIORITY_CLASS)  

Can you please inform me where do I add this?


SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST)

          SetPriorityClass(GetCurrentProcess, HIGH_PRIORITY_CLASS)

Open in new window

0
Comment
Question by:RIAS
  • 2
3 Comments
 
LVL 7

Expert Comment

by:HalfAsleep
ID: 24106720
Anywhere after createThread and before you start your thread processing/loop.
0
 

Author Comment

by:RIAS
ID: 24108288
How do i know which thread is the priority
0
 
LVL 7

Accepted Solution

by:
HalfAsleep earned 500 total points
ID: 24108784
You have to give a handle to a thread as a parameter, in your case, getCurrentThread is used to get the handle of the currently executing thread, so whatever thread is running that code, is the one that will get its priority changed. Is that what you asked for? I can have a look at the article later, but setting a thread priority that high is not that common, but then again, I have not read the article yet.
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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

939 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

7 Experts available now in Live!

Get 1:1 Help Now