Thread client_th;
ParameterizedThreadStart threadStart = new ParameterizedThreadStart( messagepass);
client_th = new Thread(threadStart);
上面我启动了一个异常,可线程中的异常不会被启动线程的程序所捕捉,因为需要,我不想在线种程序中把异常吃掉,这样可能无法通告上层出了什么事,我把这个异常在纯种中捕获后又throw了出来;
问题:我现在在启动的这个地方如何来捕获这个异常,从面可以让上层来处理我的异常?
ParameterizedThreadStart threadStart = new ParameterizedThreadStart( messagepass);
client_th = new Thread(threadStart);
上面我启动了一个异常,可线程中的异常不会被启动线程的程序所捕捉,因为需要,我不想在线种程序中把异常吃掉,这样可能无法通告上层出了什么事,我把这个异常在纯种中捕获后又throw了出来;
问题:我现在在启动的这个地方如何来捕获这个异常,从面可以让上层来处理我的异常?
如果真要这样做你可以把catch中的exception存到string变量里。string变量是外部的共有变量,也就是你的线程和开启线程的地方都能访问这个string变量。然后主线程访问这个string变量,如果不是null就把他的内容显示出来
通过参数传递出来异常信息
void run(){
try{
}catch{
输出参数
}
}