summaryrefslogtreecommitdiffstats
path: root/async/src/async.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'async/src/async.cpp')
-rw-r--r--async/src/async.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/async/src/async.cpp b/async/src/async.cpp
index 5e26bd8..c780878 100644
--- a/async/src/async.cpp
+++ b/async/src/async.cpp
@@ -24,6 +24,50 @@
24 24
25using namespace Async; 25using namespace Async;
26 26
27Private::Execution::Execution(const Private::ExecutorBasePtr &executor)
28 : executor(executor)
29 , resultBase(nullptr)
30 , isRunning(false)
31 , isFinished(false)
32{
33}
34
35Private::Execution::~Execution()
36{
37 if (resultBase) {
38 resultBase->releaseExecution();
39 delete resultBase;
40 }
41 prevExecution.reset();
42}
43
44void Private::Execution::setFinished()
45{
46 isFinished = true;
47 //executor.clear();
48}
49
50void Private::Execution::releaseFuture()
51{
52 resultBase = 0;
53}
54
55bool Private::Execution::errorWasHandled() const
56{
57 Execution * const exec = this;
58 while (exec) {
59 if (exec->executor->hasErrorFunc()) {
60 return true;
61 }
62 exec = exec->prevExecution.data();
63 }
64 return false;
65}
66
67
68
69
70
27Private::ExecutorBase::ExecutorBase(const ExecutorBasePtr &parent) 71Private::ExecutorBase::ExecutorBase(const ExecutorBasePtr &parent)
28 : mPrev(parent) 72 : mPrev(parent)
29{ 73{
@@ -34,6 +78,8 @@ Private::ExecutorBase::~ExecutorBase()
34} 78}
35 79
36 80
81
82
37JobBase::JobBase(const Private::ExecutorBasePtr &executor) 83JobBase::JobBase(const Private::ExecutorBasePtr &executor)
38 : mExecutor(executor) 84 : mExecutor(executor)
39{ 85{