第一次上传
This commit is contained in:
36
Threads/SubThread.cpp
Normal file
36
Threads/SubThread.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include "SubThread.h"
|
||||
|
||||
SubThread::SubThread()
|
||||
{
|
||||
isPause = false;
|
||||
isLoop = true;
|
||||
}
|
||||
void SubThread::ReStart(){
|
||||
isPause = false;
|
||||
}
|
||||
void SubThread::PauseThread()
|
||||
{
|
||||
isPause = true;
|
||||
}
|
||||
void SubThread::KillThread()
|
||||
{
|
||||
isLoop = false;
|
||||
wait();
|
||||
thread()->quit();
|
||||
}
|
||||
|
||||
void SubThread::executeThreadLogic()
|
||||
{
|
||||
// 在这里实现线程的逻辑
|
||||
|
||||
while (isLoop)
|
||||
{
|
||||
QThread::msleep(CONFIG_EN_SUB_THREAD_TIME);//这个是子线程的基础时间,意在多长时间循环一次,单位毫秒
|
||||
if(isPause) continue;
|
||||
|
||||
}
|
||||
}
|
||||
void SubThread::run()
|
||||
{
|
||||
executeThreadLogic();
|
||||
}
|
||||
Reference in New Issue
Block a user