public static Thread consoleThread;
public static void StartAnalysis(){
consoleThread=new Thread(TCPClient.ReceiveTCPMsg);
consoleThread.isBackground=true;
consoleThread.Start(Globel.socket);
}
if(Globel.socket.Poll(100000,SelectMode.SelectRead)){
SocketInit();//建立新的socket连接,更新Globel.socket
DataAnalysis.consoleThread.Abort();//结束之前的监听线程
DataAnalysis.consoleThread=null;
//启动新的监听线程
DataAnalysis.consoleThread=new Thread(TCPClient.ReceiveTCPMsg);
DataAnalysis.consoleThread.isBackground=true;
DataAnalysis.consoleThread.Start(Globel.socket);
}
引发的异常:“System.Threading.ThreadAbortException”,
,但是功能已经实现了,就是后台抛异常。
这异常是不是因为在线程中关闭了线程?
原来如此懂了