Made step to remove ASyncWindow in favour of usage of Future and FutureWatcher.
This should allow concurrency in the plugins to be independent from their container. Contains also some work on the system for registering plugins.
This commit is contained in:
parent
a54a063c13
commit
15bee33076
25 changed files with 327 additions and 52 deletions
|
|
@ -12,8 +12,9 @@ template <class T>
|
|||
class ControllableTask
|
||||
{
|
||||
public:
|
||||
using Result = T;
|
||||
virtual ~ControllableTask() {}
|
||||
virtual T run(TaskControl& control) = 0;
|
||||
virtual Result run(TaskControl& control) = 0;
|
||||
};
|
||||
|
||||
#endif // CONTROLLABLETASK_H
|
||||
|
|
|
|||
|
|
@ -7,14 +7,16 @@
|
|||
|
||||
#include <QFutureInterface>
|
||||
#include <QRunnable>
|
||||
#include <QThreadPool>
|
||||
#include "ControllableTask.h"
|
||||
#include "TaskControl.h"
|
||||
|
||||
template <typename T>
|
||||
class RunControllableTask : public QFutureInterface<T> , public QRunnable
|
||||
{
|
||||
public:
|
||||
RunControllableTask(ControllableTask<T>* tsk) : task(tsk) { }
|
||||
virtial ~RunControllableTask() { delete task; }
|
||||
virtual ~RunControllableTask() { delete task; }
|
||||
|
||||
QFuture<T> start()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
#include <QFutureInterfaceBase>
|
||||
|
||||
class TaskControl
|
||||
{
|
||||
class TaskControl {
|
||||
public:
|
||||
TaskControl(QFutureInterfaceBase *f) : fu(f) { }
|
||||
bool shouldRun() const { return !fu->isCanceled(); }
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
#include "ControllableTask.h"
|
||||
#include "RunControllableTask.h"
|
||||
|
||||
#include <QFuture>
|
||||
/**
|
||||
* @brief The TaskExecutor class
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue