M
Michel
Hi there,
I have a thread pool that contains a number of threads waiting for jobs to
process.
The logic for stopping a thread is that I check if the thread is in waiting
mode, if so, I abort it.
The run method of the thread is basically this:
while(!IsAborted)
try {
JobQueue.Pop().Execute(); // If there no jobs, Pop() enters Monitor.Wait
} catch (ThreadAbortException) {
IsAborted = true;
Thread.ResetAbort();
}
This works fine as long as I don't change the ApartmentState to
ApartmentState.STA. When I change it to STA, I never get to the
ThreadAbortException block.
Any ideas appreciated!
Thanks,
Michel
I have a thread pool that contains a number of threads waiting for jobs to
process.
The logic for stopping a thread is that I check if the thread is in waiting
mode, if so, I abort it.
The run method of the thread is basically this:
while(!IsAborted)
try {
JobQueue.Pop().Execute(); // If there no jobs, Pop() enters Monitor.Wait
} catch (ThreadAbortException) {
IsAborted = true;
Thread.ResetAbort();
}
This works fine as long as I don't change the ApartmentState to
ApartmentState.STA. When I change it to STA, I never get to the
ThreadAbortException block.
Any ideas appreciated!
Thanks,
Michel