T
Trev Hunter
Hi All,
I was just wondering if it is safe to change thread priorities with thread
pool threads (threads used by System.Threading.Timer and those used by the
ThreadPool class itself).
Say I have a background task that runs periodically (it uses
System.Threading.Timer to do this). As the execution speed of this task is
not a priority, I want to be able to set the priority of the current thread
to the lowest possible. If I use
----------
Thread.CurrentThread.Priority = ThreadPriority.Lowest
----------
to set the priority of the thread at the start of the background processing,
will this adversely affect the thread once it goes back into the thread
pool? Is there a chance that another task may come along and use this thread
and have its default priority set to whatever I last set it to, or does the
priority get reset when the thread is recycled? I don't know much about the
internal workings of the thread pool, so any help is welcome.
On another note, is there a better way of specifying what priority a
background task should be run with?
Thanks for your help,
Trev.
I was just wondering if it is safe to change thread priorities with thread
pool threads (threads used by System.Threading.Timer and those used by the
ThreadPool class itself).
Say I have a background task that runs periodically (it uses
System.Threading.Timer to do this). As the execution speed of this task is
not a priority, I want to be able to set the priority of the current thread
to the lowest possible. If I use
----------
Thread.CurrentThread.Priority = ThreadPriority.Lowest
----------
to set the priority of the thread at the start of the background processing,
will this adversely affect the thread once it goes back into the thread
pool? Is there a chance that another task may come along and use this thread
and have its default priority set to whatever I last set it to, or does the
priority get reset when the thread is recycled? I don't know much about the
internal workings of the thread pool, so any help is welcome.
On another note, is there a better way of specifying what priority a
background task should be run with?
Thanks for your help,
Trev.