summaryrefslogtreecommitdiffstats
path: root/src/server/Task.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-04-03 18:23:08 +0200
committerDavid Robillard <d@drobilla.net>2018-04-03 18:23:08 +0200
commit76c3ac8d285deef88f41e6cbba1f3c77a49df179 (patch)
treeb02966fef554acac5924898df8b3d76d35723258 /src/server/Task.hpp
parent7a5e694c3ffed12532ee2b97f99c4b56dbba4d02 (diff)
downloadingen-76c3ac8d285deef88f41e6cbba1f3c77a49df179.tar.gz
ingen-76c3ac8d285deef88f41e6cbba1f3c77a49df179.tar.bz2
ingen-76c3ac8d285deef88f41e6cbba1f3c77a49df179.zip
WIP: parallel stuffparallel-work
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);