You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.6 KiB
C++

#pragma once
#include "GlobalDefine.h"
//线程的类型
enum EThreadType
{
_EThreadType_NULL=0,
_EThreadType_AutoWorkFlowCtrlThread,//工作流程控制线程
_EThreadType_LaserSleepThread,//激光休眠线程
_EThreadType_GetDataPtThread,//运行时测量线程
_EThreadType_ExecuteStepThread,//步骤执行线程
_EThreadType_FastReadInfoThread,//状态读取线程(fast)
_EThreadType_SlowReadInfoThread,//状态读取线程(slow)
_EThreadType_PlcReadInfoThread,//PLC 通信线程
_EThreadType_LaserDisMeterReadThread,//测距仪通信线程
_EThreadType_SwitchLaserLddThread,//Beamtech激光器ldd 线程
_EThreadType_BeamtechSetParToLaserThread,//Beamtech激光器参数线程
_EThreadType_TimingProgressThread,//进度条线程
_EThreadType_WaferAdjustCtrlThread,//晶圆准直线程
_EThreadType_RecordTimeThread,//记录计时线程
_EThreadType_DlgDeviceStateInfoTimer,//状态信息timer
_EThreadType_DlgDeviceStateInfoTimer2,//状态信息timer2
_EThreadType_ReadLaserPower,//功率计timer
_EThreadType_WaitTransferLoadEndThread,//等待load 结束线程
_EThreadType_CheckTransferLoadThread,//检查是否需要load 的线程
_EThreadType_ReadLaserInfoThread,
_EThreadType_ReadRedLaserInfoThread,
_EThreadType_ReadTekOscilloscopeInfoThread,//读取示波器信息
_EThreadType_AutoTransferFlowThread,//自动传片测试流程控制线程
_EThreadType_ReadTransferArmInfoThread,
_EThreadType_UpdateSecsDataThread,
_EThreadType_CtrlHostJobThread,
_EThreadType_CyclicRunThread,
};
class CThreadInfo
{
public:
CThreadInfo(void)
{
m_bRunning = false;
m_pThread = NULL;//线程的指针
};
public:
EThreadType m_ThreadType;//线程类型
CWinThread* m_pThread;//线程的指针
CString m_ThreadName;//线程的名字
bool m_bRunning;//是否正在运行
CString m_LastRunTime;//最近一次运行的时间(用来看线程是否挂掉)
};
class CAllThreadMgr
{
public:
CAllThreadMgr(void);
~CAllThreadMgr(void);
void InsertThreadInfoList(CListCtrl &List,bool bInsert);
void BindingThreadAdr(EThreadType ThreadType,CWinThread*p);
void SetThreadInfoState(EThreadType ThreadType,bool bRunning);
void StopAllThread();
bool IsbStopAllThread();
COLORREF GetStateColor(int idx);
bool HasThreadRunning();
void WriteAllTreadTimeToFile();
bool IsThreadRunning(EThreadType ThreadType);
void ShowRunningThreadName();
private:
void InitThreadInfoVec();
void UpdateThreadTime(EThreadType ThreadType);
private:
vector<CThreadInfo> m_ThreadInfoVec;//线程容器
};
extern CAllThreadMgr gAllThreadMgr;
extern bool gbStopAllThread;//停止所有线程