Board index » Visual Studio » Set my own priority
|
shamunmic
|
|
shamunmic
|
Set my own priority
Visual Studio142
I've got a long running, intensive application that I am writing. I'd like to set my own Priority. Most of the time I want to lower it so I don't eat up the entire processor. I know how to do it with a thread, but how about to myself (so to speak)? Thanks, Tom - |
| Cor
Registered User |
Fri Feb 06 06:27:18 CST 2004
Re:Set my own priority
Hi Tom,
Here a link, do not become afraid, for your current application thread it is just threading.ThreadPriority.BelowNormal http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/library/en-us/cpref/html/frlrfsystemthreadingthreadpriorityclasstopic.asp I hope this helps? Cor - |
| hirf-spam-me-here
Registered User |
Fri Feb 06 07:07:05 CST 2004
Re:Set my own priority
* "Tom Scales" <tomtoo@softhome.net>scripsit:
QuoteI've got a long running, intensive application that I am writing. I'd like -- Herfried K. Wagner [MVP] <www.mvps.org/dotnet>">www.mvps.org/dotnet> - |
| Iouri
Registered User |
Fri Feb 06 09:17:29 CST 2004
Re:Set my own priority
' Change the priority of the application's thread.
Sub SetAppPriority( _ ByVal Thread As System.Threading.Thread, _ ByVal NewPriority As System.Threading.ThreadPriority) ' Change the priority of the specified thread ' ThreadPriority is one of: ' AboveNormal ' BelowNormal ' Highest ' Lowest ' Normal ' Thread.Priority = NewPriority End Sub "Tom Scales" <tomtoo@softhome.net>wrote in message QuoteI've got a long running, intensive application that I am writing. I'd like - |
| Tom
Registered User |
Fri Feb 06 10:13:55 CST 2004
Re:Set my own priority
I know how to do that, but it is for a thread. I want to do it to 'myself'
or the main application. I don't want to spawn a new thread. Am I missing something? "Cor" <non@non.com>wrote in message QuoteHi Tom, - |
| Tom
Registered User |
Fri Feb 06 10:15:03 CST 2004
Re:Set my own priority
Ah, that's what I was missing.
Thanks! Tom "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at>wrote in message Quote* "Tom Scales" <tomtoo@softhome.net>scripsit: - |
| Cor
Registered User |
Fri Feb 06 10:36:05 CST 2004
Re:Set my own priorityQuote
application, your main application thread. Let say in form1. Quote>Here a link, do not become afraid, for your current application thread - |
| hirf-spam-me-here
Registered User |
Fri Feb 06 10:51:44 CST 2004
Re:Set my own priority
* "Tom Scales" <tomtoo@softhome.net>scripsit:
QuoteI know how to do that, but it is for a thread. I want to do it to 'myself' -- Herfried K. Wagner [MVP] <www.mvps.org/dotnet>">www.mvps.org/dotnet> - |
| Dick
Registered User |
Fri Feb 06 12:23:09 CST 2004
Re:Set my own priority
Hi,
Your main application IS a thread (usually, STAThread, but still a thread). Dick -- Richard Grier (Microsoft Visual Basic MVP) See www.hardandsoftware.net for contact information. Author of Visual Basic Programmer's Guide to Serial Communications, 3rd Edition ISBN 1-890422-27-4 (391 pages) published February 2002. - |
| Trev
Registered User |
Fri Feb 06 12:36:35 CST 2004
Re:Set my own priority
In addition to what the others have mentioned about
System.Threading.Thread.CurrentThread.Priority (which lets you set the priority of the current thread), have a look at System.Diagnostics.Process.GetCurrentProcess.PriorityClass. This lets you set the priority for your process (which affects all threads in your application). You can see the change in task manager if you right click on your process and select "Set Priority". HTH, Trev. "Tom Scales" <tomtoo@softhome.net>wrote in message QuoteI've got a long running, intensive application that I am writing. I'd like - |
| Tom
Registered User |
Sat Feb 07 08:41:24 CST 2004
Re:Set my own priority
Thanks to all! I finally have it figured out. I will try the Priority class
too. Don't know why this split into two threads -- just posted once. Tom "Trev Hunter" <hunter_trev@hotmail.com>wrote in message QuoteIn addition to what the others have mentioned about - |
