Commit 608fed1a authored by Karel Slaný's avatar Karel Slaný

Starting and stopping the worker pool directly from main().

parent 42d42185
......@@ -36,7 +36,7 @@ class Accounts : public QObject {
Q_OBJECT
public:
Accounts(QObject *parent = Q_NULLPTR);
explicit Accounts(QObject *parent = Q_NULLPTR);
/*!
* @brief Get account data box ID from database.
......
/*
* Copyright (C) 2014-2017 CZ.NIC
* Copyright (C) 2014-2018 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -38,7 +38,7 @@ public:
*
* @param[in] parent Parent object.
*/
Locker(QObject *parent = Q_NULLPTR);
explicit Locker(QObject *parent = Q_NULLPTR);
/*!
* @brief Sets internal flag. Following immediate application
......
......@@ -66,6 +66,7 @@
#include "src/sqlite/file_db_container.h"
#include "src/sqlite/message_db_container.h"
#include "src/sqlite/zfo_db.h"
#include "src/worker/pool.h"
#include "src/zfo.h"
/* iOS app_delegate - for interaction with iOS action Open in... */
......@@ -287,6 +288,10 @@ int main(int argc, char *argv[])
}
app.installTranslator(&qtbaseTrans);
/* Start worker threads. */
globWorkPool.start();
logInfoNL("%s", "Worker pool started.");
/* Init and use these class - we need register it to QML */
Messages messages;
Accounts accounts;
......@@ -511,6 +516,12 @@ int main(int argc, char *argv[])
/* Run app main event loop */
int ret = app.exec();
/* Wait until all threads finished. */
logInfoNL("%s", "Waiting for pending worker threads.");
globWorkPool.wait();
globWorkPool.stop();
logInfoNL("%s", "All worker threads finished");
/* Close all OTP connections if exist */
isds.closeAllOtpConnections();
......
/*
* Copyright (C) 2014-2017 CZ.NIC
* Copyright (C) 2014-2018 CZ.NIC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -56,7 +56,7 @@ public:
*
* @param[in] parent Parent object.
*/
Messages(QObject *parent = Q_NULLPTR);
explicit Messages(QObject *parent = Q_NULLPTR);
/*!
* @brief Load contacts from database and fill QML listview via model.
......
......@@ -60,8 +60,6 @@ IsdsWrapper::IsdsWrapper(QObject *parent)
* waiting.
*/
{
globWorkPool.start();
/* Worker-related processing signals. */
connect(&globMsgProcEmitter,
SIGNAL(downloadAccountInfoFinishedSignal(QString, bool, QString)),
......@@ -92,12 +90,6 @@ IsdsWrapper::IsdsWrapper(QObject *parent)
SLOT(sendMessageFinished(QString, QString, QString, QString, qint64, bool, QString)));
}
IsdsWrapper::~IsdsWrapper(void)
{
globWorkPool.wait();
globWorkPool.stop();
}
QString IsdsWrapper::importZfoMessages(const QString &userName,
const QStringList &fileList, bool authenticate)
{
......
......@@ -48,11 +48,6 @@ public:
*/
explicit IsdsWrapper(QObject *parent = Q_NULLPTR);
/*!
* @brief Destructor.
*/
~IsdsWrapper(void);
/*!
* @brief Import ZFO files to local database.
*
......
......@@ -95,19 +95,11 @@ RecordsManagement::RecordsManagement(QObject *parent)
: QObject(parent),
m_rmc(RecordsManagementConnection::ignoreSslErrorsDflt, this)
{
globWorkPool.start();
connect(&globMsgProcEmitter,
SIGNAL(rmSyncFinishedSignal(QString, int, int)),
this, SLOT(rmSyncFinished(QString, int, int)));
}
RecordsManagement::~RecordsManagement(void)
{
globWorkPool.wait();
globWorkPool.stop();
}
bool RecordsManagement::callServiceInfo(const QString &urlStr,
const QString &tokenStr)
{
......
......@@ -35,12 +35,7 @@ public:
/*!
* @brief Constructor.
*/
RecordsManagement(QObject *parent = Q_NULLPTR);
/*!
* @brief Destructor.
*/
~RecordsManagement(void);
explicit RecordsManagement(QObject *parent = Q_NULLPTR);
/*!
* @brief Calls service info and displays results.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment