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.
53 lines
1.1 KiB
C
53 lines
1.1 KiB
C
|
4 years ago
|
/******************************************************************************
|
||
|
|
Copyright(C):2015~2018 hzleaper
|
||
|
|
FileName:ZkThread.h
|
||
|
|
Author:zhikun wu
|
||
|
|
Email:zk.wu@hzleaper.com
|
||
|
|
Tools:vs2010 pc on company
|
||
|
|
Created:2015/04/27
|
||
|
|
History:27:4:2015 15:16
|
||
|
|
*******************************************************************************/
|
||
|
|
#ifndef __ZK_THREAD_H
|
||
|
|
#define __ZK_THREAD_H
|
||
|
|
|
||
|
|
#include "zclasses.h"
|
||
|
|
|
||
|
|
class CZkThread : public ZThread
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
|
||
|
|
public:
|
||
|
|
CZkThread(void);
|
||
|
|
virtual ~CZkThread(void);
|
||
|
|
enum emThreadRun{
|
||
|
|
RUN_STOP = 0,
|
||
|
|
RUN_LOOP = 1,
|
||
|
|
RUN_EVENT = 2,
|
||
|
|
};
|
||
|
|
void Start(emThreadRun tRun = RUN_LOOP);
|
||
|
|
void End();
|
||
|
|
emThreadRun RunType() {
|
||
|
|
return m_threadRun;
|
||
|
|
}
|
||
|
|
protected:
|
||
|
|
virtual int enter() { return 1; }
|
||
|
|
virtual int loop() { return 0; }
|
||
|
|
virtual int tail() { return 0; }
|
||
|
|
/*
|
||
|
|
protected Q_SLOTS:
|
||
|
|
virtual void onStarted();
|
||
|
|
virtual void onFinished();
|
||
|
|
*/
|
||
|
|
private:
|
||
|
|
virtual void run();
|
||
|
|
//Q_SIGNAL void sgQuit();
|
||
|
|
protected:
|
||
|
|
emThreadRun m_threadRun;
|
||
|
|
private:
|
||
|
|
bool m_bIsRunning;
|
||
|
|
bool m_bSigalToRun;
|
||
|
|
Qt::HANDLE m_thdId;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif
|