在 thread.Abort() 之后会发生什么?
说我有:
Thread mWorker = new Thread(new ThreadStart(this.run));
..
mWorker.Start();
**where**
private void run()
{
Logger.d(TAG, "run()");
...
try {
while (this.mRunning){
...
}
} catch (ThreadAbortException tae){
Logger.e(TAG,"some msg", tae);
this.doSomething();
} catch (IOException ioe){
Logger.e(TAG,"some msg", ioe);
this.doSomething();
} catch (Exception e){
Logger.e(TAG,"some msg", e);
this.doSomething();
} finally {
gracefoulyClose();
}
Logger.d(TAG, "run() - ended");
}
线程更复杂..但这里显示了本质。那么当 Abort() 被调用时会发生什么?我的 catch 会起作用并继续调用 doSomething() 吗?
因为我仍然在控制台中收到:
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code
但我确实对此有把握。我不是吗??