这是一个用来监控本地文件夹变化的服务
w1146869587
2021-11-09 f5e3a3a6785cd9305c476eadf329c8ae00161add
mbwatch/mbtaskmgr.cpp
@@ -1,9 +1,11 @@
#include "mbtaskmgr.h"
#include "mbtasklog.h"
CMBTaskMgr::CMBTaskMgr()
{
    m_pMdWare = NULL;
    //线程池最多1个线程
    m_threadPool.setMaxThreadCount(1);
    m_threadPool.setMaxThreadCount(3);
}
CMBTaskMgr::~CMBTaskMgr()
@@ -11,14 +13,24 @@
}
void CMBTaskMgr::setMdWare(CMBMdware *pMdWare)
{
    m_pMdWare = pMdWare;
}
void CMBTaskMgr::stopThread()
{
    m_threadPool.waitForDone(100); // 100毫秒
}
void CMBTaskMgr::logTask(QString login, QString svrID, QString backupDir, QString svrPath)
void CMBTaskMgr::logTask(QString logDbPath, QString backupDir, QString svrPath)
{
    CMBTaskLog *pTask = new CMBTaskLog();
    pTask->setMdWare(m_pMdWare);
    pTask->set(logDbPath, backupDir, svrPath);
    pTask->setAutoDelete(true);
    m_threadPool.start(pTask);
}