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.
50 lines
845 B
C++
50 lines
845 B
C++
|
|
#pragma once
|
|
|
|
#include <QThread>
|
|
#include <QMutex>
|
|
|
|
#include "iAlgBase_global.h"
|
|
#include "Defines.h"
|
|
|
|
// 线程的封装(算法模型父类)
|
|
class I_ALGBASE_EXPORT zxAlgThread :
|
|
public QThread
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
zxAlgThread();
|
|
|
|
// 进程状态
|
|
enum ThreadState
|
|
{
|
|
TS_Reset = 0, //重置
|
|
TS_Finished, //结束
|
|
|
|
TS_Running, //运行中
|
|
TS_Suspending, //挂起
|
|
TS_Quiting, //结束中
|
|
|
|
TS_ToPause, //暂停,外界传入的状态
|
|
TS_ToContinue, //继续
|
|
TS_ToQuit, //终止
|
|
|
|
TS_Unknown
|
|
};
|
|
|
|
// 状态设置
|
|
ThreadState getState();
|
|
void setState(ThreadState o);
|
|
|
|
// 状态监测
|
|
bool checkPausing();
|
|
bool checkQuiting();
|
|
|
|
private:
|
|
|
|
ThreadState m_oTs;
|
|
QMutex m_oMutex;
|
|
};
|