C++ (Qt)class CCoreServer : public QObject{ Q_OBJECTprivate:private: CServicePolling polling; CServiceArchives archiving; CServiceRules rules; CServiceTransmit transmission; QThread pollingThread; QThread archivingThread; QThread ruleThread; QThread transmissionThread; ... CCoreServer::CCoreServer(QObject *parent) : QObject(parent), polling(this), archiving(this), rules(this), transmission(this){... polling.moveToThread(&pollingThread); QObject::connect(this, &CCoreServer::servicePollingSig, &polling, &CServicePolling::serviceRunSlot, Qt::BlockingQueuedConnection); pollingThread.setObjectName("polling"); pollingThread.start(QThread::HighPriority); qInfo ("Polling thread started."); archiving.moveToThread(&archivingThread); QObject::connect(this, &CCoreServer::serviceArchiveSig, &archiving, &CServiceArchives::serviceRunSlot, Qt::BlockingQueuedConnection); archivingThread.setObjectName("archiving"); archivingThread.start(); qInfo ("Archiving thread started."); rules.moveToThread(&ruleThread); QObject::connect(this, &CCoreServer::serviceRuleSig, &rules, &CServiceRules::serviceRunSlot, Qt::BlockingQueuedConnection); QObject::connect(this, &CCoreServer::loadRuleSig, &rules, &CServiceRules::loadRulesSlot); ruleThread.setObjectName("rules"); ruleThread.start(); qInfo ("Rules thread started."); transmission.moveToThread(&transmissionThread); QObject::connect(this, &CCoreServer::serviceTransmissionSig, &transmission, &CServiceTransmit::serviceRunSlot, Qt::BlockingQueuedConnection); transmissionThread.setObjectName("transmission"); transmissionThread.start(QThread::LowPriority); qInfo ("Transmission thread started.");
C++ (Qt)void CCoreServer::startServices() {... if(COptions::autoPolling) emit servicePollingSig(true); else qInfo("CoreServer: service of polling disabled."); if(COptions::autoArchiving) emit serviceArchiveSig(true);...
C++ (Qt)Q_DECLARE_METATYPE(CRequestArgs)...{ if(!QMetaType::isRegistered(QMetaType::type("CRequestArgs"))) qRegisterMetaType <CRequestArgs> ("CRequestArgs");...