HANDLE g_Hworkflow;//工作流程
HANDLE g_Hcollect;//数据采集
//无信号人工事件
CEvent g_Econtrol(FALSE,TRUE);//控制线程
//默认是无信号自动事件
CEvent g_ZeroEcontrol;//控制线程
//默认是无信号自动事件
CEvent g_TestEcontrol;//控制线程
//创建多线程
//开始试验流程、采集流程
CWinThread * pWindThread;
pWindThread = AfxBeginThread(Thread_WorkFlow,this);
g_Hworkflow = pWindThread->m_hThread;
pWindThread = AfxBeginThread(Thread_CollectSensor,this);
g_Hcollect = pWindThread->m_hThread;
//线程中写
while (WaitForSingleObject(g_Econtrol,2000)!=WAIT_OBJECT_0)
{
}
//
g_Econtrol.SetEvent();
if(g_nCurProcess==1)
WaitForSingleObject(g_ZeroEcontrol,INFINITE);
else if(g_nCurProcess==2)
WaitForSingleObject(g_TestEcontrol,INFINITE);