110,557
社区成员
发帖
与我相关
我的任务
分享
private void StopQueryDataThread()
{
// 终止数据查询线程
m_stopQuery = true;
if (m_dataQueryThread != null)
{
m_dataQueryThread.Join(300);
if ((m_dataQueryThread != null) && (m_dataQueryThread.IsAlive))
{
m_dataQueryThread.Abort();
}
m_dataQueryThread = null;
}
}
private bool StartMonitorConnectionThread()
{
try
{
m_connectionMonitorThread = new Thread(new ThreadStart(MonitorConnectionThreadStart));
m_connectionMonitorThread.Priority = ThreadPriority.Lowest;
m_connectionMonitorThread.Name = "连接监视线程";
m_connectionMonitorThread.Start();
m_stopMonitor = false;
}
catch (ThreadStateException) // 线程已启动
{
return true;
}
catch (SecurityException) // 调用方没有适当的 SecurityPermission
{
return false;
}
catch (OutOfMemoryException) // 没有足够的内存启动该线程
{
return false;
}
return true;
}