views:

127

answers:

2

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?

+2  A: 

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

ESRogs