Solved

SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_HIGHEST)

Posted on 2009-04-09
3
1,156 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

15 Experts available now in Live!

Get 1:1 Help Now