Added WorkManager to manage background tasks.

Relies heavily on the QThreadPool.
This commit is contained in:
eelke 2017-12-25 15:32:02 +01:00
parent 190a6c04dc
commit 6d4662aa98
3 changed files with 71 additions and 2 deletions

20
core/WorkManager.h Normal file
View file

@ -0,0 +1,20 @@
#ifndef WORKMANAGER_H
#define WORKMANAGER_H
#include <functional>
#include <memory>
class QRunnable;
class WorkManager {
public:
static std::shared_ptr<WorkManager> getWorkManager();
using Work = std::function<void()>;
virtual void addRunnable(QRunnable *runnable) = 0;
virtual void addWork(Work work) = 0;
};
#endif // WORKMANAGER_H