Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Executable run at a lower priority [duplicate]

Possible Duplicate:
Setting a thread priority in a service

I've created a Windows Service and I want it to always run at LOW priority. Is there any way to achieve this via code or how I package up the install?

like image 947
Keith Adler Avatar asked Oct 15 '22 13:10

Keith Adler


1 Answers

Try modifying System.Diagnostics.Process.GetCurrentProcess().PriorityClass and/or System.Threading.CurrentThread.Priority.

Note that: "threads with different priorities that are running in the process run relative to the priority class of the process" (1). Also, changing the Priority property of a ThreadPool thread has no effect.


1) http://msdn.microsoft.com/en-us/library/system.diagnostics.process.priorityclass.aspx
2) http://msdn.microsoft.com/en-us/library/system.threading.thread.priority.aspx

like image 169
ESRogs Avatar answered Oct 25 '22 14:10

ESRogs