summaryrefslogtreecommitdiffstats
path: root/src/server/Task.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Task.hpp')
-rw-r--r--src/server/Task.hpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/server/Task.hpp b/src/server/Task.hpp
index 79ada9f0..a425c466 100644
--- a/src/server/Task.hpp
+++ b/src/server/Task.hpp
@@ -26,6 +26,8 @@
#include <boost/variant/variant.hpp>
+#include "Job.hpp"
+
namespace Ingen {
namespace Server {
@@ -66,8 +68,7 @@ struct ParTask : MultiTask {
ParTask() = default;
ParTask(ParTask&& task)
- : done_end(task.done_end)
- , next(task.next.load())
+ : next(task.next.load())
, done(task.done.load())
{
children = std::move(task.children);
@@ -75,29 +76,23 @@ struct ParTask : MultiTask {
ParTask& operator=(ParTask&& task) {
children = std::move(task.children);
- done_end = task.done_end;
next = task.next.load();
done = task.done.load();
return *this;
}
- unsigned done_end{0}; ///< Index of rightmost done sub-task
std::atomic<unsigned> next{0}; ///< Index of next sub-task
- std::atomic<bool> done{false}; ///< Completion phase
-};
-
-struct Job {
- Task task;
+ std::atomic<unsigned> done{0}; ///< Count of finished sub-tasks
};
/** Run task in the given context. */
-void run(Task& task, RunContext& context);
+void run(Job& job, RunContext& context);
/** Simplify and optimize task. */
Task simplify(Task&& task);
/** Steal a child task from this task. */
-Task* steal(ParTask& task, RunContext& context);
+Job steal(ParTask& task, RunContext& context);
/** Pretty print task to the given stream (recursively). */
void dump(Task& task, std::function<void (const std::string&)> sink, unsigned indent, bool first);