diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-03-15 13:11:51 +0100 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2024-03-15 13:11:51 +0100 |
commit | c3c914828a4db958893aaf307cc79d9aaf970431 (patch) | |
tree | 0242ebec7d873f8185217bea3b4e02bfd3536fda /modules/async/c++/async.tmpl.hpp | |
parent | 7dc6c28f72893dd428a4b5b39a34c5c6b85965a2 (diff) |
async, io: Fixing async tests for io
Diffstat (limited to 'modules/async/c++/async.tmpl.hpp')
-rw-r--r-- | modules/async/c++/async.tmpl.hpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/modules/async/c++/async.tmpl.hpp b/modules/async/c++/async.tmpl.hpp index ba2a0b3..98573b5 100644 --- a/modules/async/c++/async.tmpl.hpp +++ b/modules/async/c++/async.tmpl.hpp @@ -106,14 +106,28 @@ std::pair<conveyor<T>, merge_conveyor<T>> conveyor<T>::merge() { std::move(node_ref)); } -template <> +/** + * + */ +template <typename T> template <typename ErrorFunc> -conveyor_sink conveyor<void>::sink(ErrorFunc &&error_func) { - conveyor_storage *storage = node_->next_storage(); +conveyor_sink conveyor<T>::sink(ErrorFunc &&error_func) { + conveyor<void> conv_then = [&,this](){ + if constexpr (std::is_same_v<T,void> ){ + return then([](){}, std::move(error_func)); + }else{ + return then([](T&&){}, std::move(error_func)); + } + }(); + auto nas = conveyor<void>::from_conveyor(std::move(conv_then)); + assert(nas); + + conveyor_storage *storage = nas->next_storage(); + SAW_ASSERT(storage) { return conveyor_sink{}; } own<sink_conveyor_node> sink_node = - heap<sink_conveyor_node>(std::move(node_)); + heap<sink_conveyor_node>(std::move(nas)); conveyor_storage *storage_ptr = static_cast<conveyor_storage *>(sink_node.get()); @@ -287,11 +301,15 @@ template <typename T> void immediate_conveyor_node<T>::parent_has_fired() { arm_next(); } } - +} +#include <iostream> +namespace saw { template <typename T> void immediate_conveyor_node<T>::fire() { - + std::cout<<"Immediate fire"<<std::endl; if (parent_) { + std::cout<<"Immediate parent: "<<queued()<<" "<<parent_->space()<<std::endl; parent_->child_has_fired(); + std::cout<<"Immediate parent2: "<<queued()<<" "<<parent_->space()<<std::endl; if (queued() > 0 && parent_->space() > 0) { arm_last(); } |