Commit c7aae68e authored by Dominik Charousset's avatar Dominik Charousset

Make await_data customizable by making it virtual

parent cda62364
......@@ -302,14 +302,16 @@ public:
return fail_state_;
}
/// @cond PRIVATE
// -- customization points ---------------------------------------------------
/// Blocks until at least one message is in the mailbox.
void await_data();
virtual void await_data();
/// Blocks until at least one message is in the mailbox or
/// the absolute `timeout` was reached.
bool await_data(timeout_type timeout);
virtual bool await_data(timeout_type timeout);
/// @cond PRIVATE
/// Receives messages until either a pre- or postcheck of `rcc` fails.
template <class... Ts>
......@@ -325,12 +327,12 @@ public:
is_timeout_or_catch_all
>::type;
filtered tk;
behavior bhvr{apply_args(make_behavior_impl, get_indices(tk), tup)};
behavior bhvr{apply_moved_args(make_behavior_impl, get_indices(tk), tup)};
using tail_indices = typename il_range<
tl_size<filtered>::value, sizeof...(Ts)
>::type;
make_blocking_behavior_t factory;
auto fun = apply_args_prefixed(factory, tail_indices{}, tup, bhvr);
auto fun = apply_moved_args_prefixed(factory, tail_indices{}, tup, bhvr);
receive_impl(rcc, mid, fun);
}
......
......@@ -116,28 +116,30 @@ struct make_blocking_behavior_t {
// nop
}
inline blocking_behavior operator()(behavior& x) const {
inline blocking_behavior operator()(behavior x) const {
return {std::move(x)};
}
template <class F>
blocking_behavior_v2<F> operator()(behavior& x, catch_all<F>& y) const {
blocking_behavior_v2<F> operator()(behavior x, catch_all<F> y) const {
return {std::move(x), std::move(y)};
}
template <class F>
blocking_behavior_v3<F> operator()(behavior& x,
timeout_definition<F>& y) const {
blocking_behavior_v3<F> operator()(behavior x,
timeout_definition<F> y) const {
return {std::move(x), std::move(y)};
}
template <class F1, class F2>
blocking_behavior_v4<F1, F2> operator()(behavior& x, catch_all<F1>& y,
timeout_definition<F2>& z) const {
blocking_behavior_v4<F1, F2> operator()(behavior x, catch_all<F1> y,
timeout_definition<F2> z) const {
return {std::move(x), std::move(y), std::move(z)};
}
};
constexpr make_blocking_behavior_t make_blocking_behavior = make_blocking_behavior_t{};
} // namespace detail
} // namespace caf
......
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 to comment