Commit 7239d842 by FritzFlorian

Execute function nodes as parallel tasks.

parent df021243
#ifndef PLS_DATAFLOW_INTERNAL_BUILD_STATE_H_
#define PLS_DATAFLOW_INTERNAL_BUILD_STATE_H_
namespace pls {
namespace dataflow {
namespace internal {
enum class build_state { fresh, building, built, teardown };
}
}
}
#endif //PLS_DATAFLOW_INTERNAL_BUILD_STATE_H_
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "outputs.h" #include "outputs.h"
#include "pls/internal/helpers/seqence.h" #include "pls/internal/helpers/seqence.h"
#include "pls/pls.h"
namespace pls { namespace pls {
namespace dataflow { namespace dataflow {
...@@ -75,12 +76,15 @@ class function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0, ...@@ -75,12 +76,15 @@ class function_node<pls::dataflow::inputs<I0, I...>, pls::dataflow::outputs<O0,
} }
void execute_function(invocation_memory *invocation_memory, invocation_info invocation_info) { void execute_function(invocation_memory *invocation_memory, invocation_info invocation_info) {
input_tuple &inputs = invocation_memory->input_buffer_; auto lambda = [&]() {
output_tuple outputs; input_tuple &inputs = invocation_memory->input_buffer_;
output_tuple outputs;
execute_function_internal(inputs, typename sequence_gen<1 + sizeof...(I)>::type(),
outputs, typename sequence_gen<1 + sizeof...(O)>::type(), invocation_info); execute_function_internal(inputs, typename sequence_gen<1 + sizeof...(I)>::type(),
outputs, typename sequence_gen<1 + sizeof...(O)>::type(), invocation_info);
};
// TODO: maybe replace this with 'continuation' style invocation
pls::scheduler::spawn_child_and_wait<pls::lambda_task_by_reference<decltype(lambda)>>(lambda);
} }
template<typename T> template<typename T>
void set_invocation_info(token<T> &token, invocation_info invocation_info) { void set_invocation_info(token<T> &token, invocation_info invocation_info) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment