串口关闭出错的问题,代码如下
南风1 2008-03-14 04:04:30 try
{
if (recThread.IsAlive)
{
recThread.Abort();
recThread.Join();
}
}
catch (Exception ex1)
{
System.Windows.Forms.MessageBox.Show(ex1.Message);
}
try
{
if (_serialPort != null)
{
if (_serialPort.IsOpen)
{
_serialPort.Dispose();
_serialPort.Close();
}
}
}
catch (Exception ex2)
{
System.Windows.Forms.MessageBox.Show(ex2.Message);
}
其中recThread是接收串口数据的线程;
执行完_serialPort.Close();后异常,报"已关闭 Safe handle",该如何解决,谢谢