How do I make System.Timer callback on a separate threadpool, or on a dedicated thread?
Background
I have a lightweight monitor for a critical application using a System.Timer and can't figure out how to make the callback not be in a ThreadPool, and to operate at a high priority.
The reasons for this are:
If the critical app is non-responsive, the ThreadPool will send a cancellation token, or Thread.Abort, or Win32 Abort (that doesn't run a finalizer) to the hanging thread.
If the app is CPU bound, then my monitoring thread should run at a Highest priority to prevent a denial of service to my monitor
The threadpool may be exhausted due to too many threads, or a value of MaxThreads that is too low
it's not possible to set a priority on a Thread that is in the threadpool (AFAIK)
As a result I think its necessary to have a Timer and it's callback on a separate thread, though I don't know how to achieve this.
If this is possible by creating a separate AppDomain, will the CLR still allow me to issue commands to other threads in a different AppDomain?