Commit 156fd942 authored by ufownl's avatar ufownl Committed by Dominik Charousset

Deprecate `spawn_typed`

parent dd49a57d
......@@ -97,7 +97,7 @@ void test_calculators() {
self->spawn(tester<actor>, spawn(calculator), 3, 4);
self->await_all_other_actors_done();
aout(self) << "typed actor:" << endl;
self->spawn(tester<calculator_actor>, spawn_typed(typed_calculator), 5, 6);
self->spawn(tester<calculator_actor>, spawn(typed_calculator), 5, 6);
self->await_all_other_actors_done();
}
......
......@@ -189,7 +189,7 @@ void dining_philosophers() {
aout(self) << "chopstick ids are:";
std::vector<chopstick> chopsticks;
for (size_t i = 0; i < 5; ++i) {
chopsticks.push_back(spawn_typed(available_chopstick));
chopsticks.push_back(spawn(available_chopstick));
aout(self) << " " << chopsticks.back()->id();
}
aout(self) << endl;
......
......@@ -74,10 +74,10 @@ void tester(event_based_actor* self, const calculator_type& testee) {
int main() {
// test function-based impl
spawn(tester, spawn_typed(typed_calculator));
spawn(tester, spawn(typed_calculator));
await_all_actors_done();
// test class-based impl
spawn(tester, spawn_typed<typed_calculator_class>());
spawn(tester, spawn<typed_calculator_class>());
await_all_actors_done();
// done
shutdown();
......
......@@ -23,10 +23,23 @@
#include "caf/actor.hpp"
#include "caf/actor_addr.hpp"
#include "caf/typed_behavior.hpp"
#include "caf/typed_event_based_actor.hpp"
#include "caf/experimental/stateful_actor.hpp"
namespace caf {
template <class... Sigs>
class typed_event_based_actor;
namespace io {
namespace experimental {
template <class... Sigs>
class typed_broker;
} // namespace experimental
} // namespace io
enum class spawn_mode {
function,
function_with_selfptr,
......@@ -88,6 +101,31 @@ struct infer_handle_from_fun_impl<Result, typed_event_based_actor<Sigs...>*,
static constexpr spawn_mode mode = spawn_mode::function_with_selfptr;
};
// statically typed stateful actor with self pointer
template <class Result, class State, class... Sigs>
struct infer_handle_from_fun_impl<Result,
experimental::stateful_actor<
State, typed_event_based_actor<Sigs...>
>*,
true> {
using type = typed_actor<Sigs...>;
using impl =
experimental::stateful_actor<State, typed_event_based_actor<Sigs...>>;
using behavior_type = typed_behavior<Sigs...>;
static constexpr spawn_mode mode = spawn_mode::function_with_selfptr;
};
// statically typed broker with self pointer
template <class Result, class... Sigs>
struct infer_handle_from_fun_impl<Result,
io::experimental::typed_broker<Sigs...>*,
true> {
using type = typed_actor<Sigs...>;
using impl = io::experimental::typed_broker<Sigs...>;
using behavior_type = typed_behavior<Sigs...>;
static constexpr spawn_mode mode = spawn_mode::function_with_selfptr;
};
template <class F, class Trait = typename detail::get_callable_trait<F>::type>
struct infer_handle_from_fun {
using result_type = typename Trait::result_type;
......
......@@ -72,22 +72,24 @@ public:
~local_actor();
/****************************************************************************
* spawn untyped actors *
* spawn actors *
****************************************************************************/
template <class T, spawn_options Os = no_spawn_options, class... Ts>
actor spawn(Ts&&... xs) {
typename infer_handle_from_class<T>::type
spawn(Ts&&... xs) {
constexpr auto os = make_unbound(Os);
auto res = spawn_class<T, os>(host(), empty_before_launch_callback{},
std::forward<Ts>(xs)...);
return eval_opts(Os, std::move(res));
}
template <spawn_options Os = no_spawn_options, class... Ts>
actor spawn(Ts&&... xs) {
template <spawn_options Os = no_spawn_options, class F, class... Ts>
typename infer_handle_from_fun<F>::type
spawn(F fun, Ts&&... xs) {
constexpr auto os = make_unbound(Os);
auto res = spawn_functor<os>(host(), empty_before_launch_callback{},
std::forward<Ts>(xs)...);
std::move(fun), std::forward<Ts>(xs)...);
return eval_opts(Os, std::move(res));
}
......@@ -139,11 +141,11 @@ public:
}
/****************************************************************************
* spawn typed actors *
* spawn typed actors (deprecated) *
****************************************************************************/
template <class T, spawn_options Os = no_spawn_options, class... Ts>
typename actor_handle_from_signature_list<
CAF_DEPRECATED typename actor_handle_from_signature_list<
typename T::signatures
>::type
spawn_typed(Ts&&... xs) {
......@@ -154,7 +156,7 @@ public:
}
template <spawn_options Os = no_spawn_options, typename F, class... Ts>
typename infer_typed_actor_handle<
CAF_DEPRECATED typename infer_typed_actor_handle<
typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types
......
......@@ -102,20 +102,9 @@ intrusive_ptr<C> spawn_functor_impl(execution_unit* eu, BeforeLaunch cb,
/// should not be called by users of the library). This function
/// selects a proper implementation class and then delegates to `spawn_class`.
template <spawn_options Os, typename BeforeLaunch, typename F, class... Ts>
actor spawn_functor(execution_unit* eu, BeforeLaunch cb, F fun, Ts&&... xs) {
using trait = typename detail::get_callable_trait<F>::type;
using arg_types = typename trait::arg_types;
using first_arg = typename detail::tl_head<arg_types>::type;
using impl =
typename std::conditional<
std::is_pointer<first_arg>::value,
typename std::remove_pointer<first_arg>::type,
typename std::conditional<
has_blocking_api_flag(Os),
blocking_actor,
event_based_actor
>::type
>::type;
typename infer_handle_from_fun<F>::type
spawn_functor(execution_unit* eu, BeforeLaunch cb, F fun, Ts&&... xs) {
using impl = typename infer_handle_from_fun<F>::impl;
return spawn_functor_impl<Os, impl>(eu, cb, std::move(fun),
std::forward<Ts>(xs)...);
}
......@@ -127,7 +116,8 @@ actor spawn_functor(execution_unit* eu, BeforeLaunch cb, F fun, Ts&&... xs) {
/// arguments. The behavior of `spawn` can be modified by setting `Os`, e.g.,
/// to opt-out of the cooperative scheduling.
template <class C, spawn_options Os = no_spawn_options, class... Ts>
actor spawn(Ts&&... xs) {
typename infer_handle_from_class<C>::type
spawn(Ts&&... xs) {
return spawn_class<C, Os>(nullptr, empty_before_launch_callback{},
std::forward<Ts>(xs)...);
}
......@@ -136,11 +126,11 @@ actor spawn(Ts&&... xs) {
/// the remainder of `xs...` is used to invoke the functor.
/// The behavior of `spawn` can be modified by setting `Os`, e.g.,
/// to opt-out of the cooperative scheduling.
template <spawn_options Os = no_spawn_options, class... Ts>
actor spawn(Ts&&... xs) {
static_assert(sizeof...(Ts) > 0, "too few arguments provided");
template <spawn_options Os = no_spawn_options, class F, class... Ts>
typename infer_handle_from_fun<F>::type
spawn(F fun, Ts&&... xs) {
return spawn_functor<Os>(nullptr, empty_before_launch_callback{},
std::forward<Ts>(xs)...);
std::move(fun), std::forward<Ts>(xs)...);
}
/// Returns a new actor that immediately, i.e., before this function
......@@ -206,30 +196,30 @@ template <class Result,
local_actor,
typename std::remove_pointer<FirstArg>::type
>::value>
struct infer_typed_actor_base;
struct CAF_DEPRECATED infer_typed_actor_base;
template <class... Sigs, class FirstArg>
struct infer_typed_actor_base<typed_behavior<Sigs...>, FirstArg, false> {
using type = typed_event_based_actor<Sigs...>;
};
} CAF_DEPRECATED;
template <class Result, class T>
struct infer_typed_actor_base<Result, T*, true> {
using type = T;
};
} CAF_DEPRECATED;
/// Returns a new typed actor of type `C` using `xs...` as
/// constructor arguments.
template <class C, spawn_options Os = no_spawn_options, class... Ts>
typename actor_handle_from_signature_list<typename C::signatures>::type
CAF_DEPRECATED spawn_typed(Ts&&... xs) {
CAF_DEPRECATED typename actor_handle_from_signature_list<typename C::signatures>::type
spawn_typed(Ts&&... xs) {
return spawn_class<C, Os>(nullptr, empty_before_launch_callback{},
std::forward<Ts>(xs)...);
}
/// Spawns a typed actor from a functor .
template <spawn_options Os, typename BeforeLaunch, typename F, class... Ts>
typename infer_typed_actor_handle<
CAF_DEPRECATED typename infer_typed_actor_handle<
typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types
......@@ -252,7 +242,7 @@ spawn_typed_functor(execution_unit* eu, BeforeLaunch cb, F fun, Ts&&... xs) {
/// invoke the functor. This function delegates its arguments to
/// `spawn_typed_functor`.
template <spawn_options Os = no_spawn_options, typename F, class... Ts>
typename infer_typed_actor_handle<
CAF_DEPRECATED typename infer_typed_actor_handle<
typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types
......
......@@ -25,6 +25,7 @@
#include "caf/group.hpp"
#include "caf/typed_actor.hpp"
#include "caf/infer_handle.hpp"
#include "caf/spawn_options.hpp"
#include "caf/detail/type_list.hpp"
......@@ -43,10 +44,11 @@ template <spawn_options Os = no_spawn_options,
class BeforeLaunch = void (*)(abstract_actor*),
class F = behavior (*)(),
class... Ts>
actor spawn_functor(execution_unit* host,
BeforeLaunch before_launch_fun,
F fun,
Ts&&... xs);
typename infer_handle_from_fun<F>::type
spawn_functor(execution_unit* host,
BeforeLaunch before_launch_fun,
F fun,
Ts&&... xs);
template <class InputIt>
class groups_subscriber {
......@@ -77,23 +79,23 @@ struct empty_before_launch_callback {
};
/******************************************************************************
* typed actors *
* typed actors (deprecated) *
******************************************************************************/
template <class TypedBehavior, class FirstArg>
struct infer_typed_actor_handle;
struct CAF_DEPRECATED infer_typed_actor_handle;
// infer actor type from result type if possible
template <class... Sigs, class FirstArg>
struct infer_typed_actor_handle<typed_behavior<Sigs...>, FirstArg> {
using type = typed_actor<Sigs...>;
};
} CAF_DEPRECATED;
// infer actor type from first argument if result type is void
template <class... Sigs>
struct infer_typed_actor_handle<void, typed_event_based_actor<Sigs...>*> {
using type = typed_actor<Sigs...>;
};
} CAF_DEPRECATED;
template <class SignatureList>
struct actor_handle_from_signature_list;
......@@ -101,7 +103,7 @@ struct actor_handle_from_signature_list;
template <class... Sigs>
struct actor_handle_from_signature_list<detail::type_list<Sigs...>> {
using type = typed_actor<Sigs...>;
};
} CAF_DEPRECATED;
template <spawn_options Os, typename BeforeLaunch, typename F, class... Ts>
typename infer_typed_actor_handle<
......@@ -110,7 +112,7 @@ typename infer_typed_actor_handle<
typename detail::get_callable_trait<F>::arg_types
>::type
>::type
spawn_typed_functor(execution_unit*, BeforeLaunch bl, F fun, Ts&&... xs);
spawn_typed_functor(execution_unit*, BeforeLaunch bl, F fun, Ts&&... xs) CAF_DEPRECATED;
} // namespace caf
......
......@@ -220,7 +220,25 @@ private:
// has local subscriptions and a "LEAVE" message to the original group
// if there's no subscription left.
class proxy_broker;
class local_group_proxy;
using local_group_proxy_ptr = intrusive_ptr<local_group_proxy>;
class proxy_broker : public event_based_actor {
public:
explicit proxy_broker(local_group_proxy_ptr grp) : group_(std::move(grp)) {
// nop
}
behavior make_behavior();
void on_exit() {
group_.reset();
}
private:
local_group_proxy_ptr group_;
};
class local_group_proxy : public local_group {
public:
......@@ -294,30 +312,14 @@ private:
actor monitor_;
};
using local_group_proxy_ptr = intrusive_ptr<local_group_proxy>;
class proxy_broker : public event_based_actor {
public:
explicit proxy_broker(local_group_proxy_ptr grp) : group_(std::move(grp)) {
// nop
}
behavior make_behavior() {
return {
others >> [=] {
group_->send_all_subscribers(current_sender(), current_message(),
host());
}
};
}
void on_exit() {
group_.reset();
}
private:
local_group_proxy_ptr group_;
};
behavior proxy_broker::make_behavior() {
return {
others >> [=] {
group_->send_all_subscribers(current_sender(), current_message(),
host());
}
};
}
class local_group_module : public abstract_group::module {
public:
......
......@@ -136,7 +136,7 @@ testee::behavior_type testee_impl(testee::pointer self) {
CAF_TEST(sync_send_atom_constants) {
scoped_actor self;
auto tst = spawn_typed(testee_impl);
auto tst = spawn(testee_impl);
self->sync_send(tst, abc_atom::value).await(
[](int i) {
CAF_CHECK_EQUAL(i, 42);
......
......@@ -771,7 +771,7 @@ typed_testee::behavior_type testee() {
CAF_TEST(typed_await) {
scoped_actor self;
auto x = spawn_typed(testee);
auto x = spawn(testee);
self->sync_send(x, abc_atom::value).await(
[](const std::string& str) {
CAF_CHECK_EQUAL(str, "abc");
......
......@@ -76,7 +76,7 @@ CAF_TEST(basic_usage) {
}
CAF_TEST(either_in_typed_interfaces) {
auto mf = spawn_typed(my_foo);
auto mf = spawn(my_foo);
scoped_actor self;
self->sync_send(mf, 42).await(
[](int val) {
......
......@@ -123,7 +123,7 @@ CAF_TEST(dynamic_stateful_actor) {
}
CAF_TEST(typed_stateful_actor) {
test_adder(spawn_typed(typed_adder));
test_adder(spawn(typed_adder));
}
CAF_TEST(dynamic_stateful_actor_class) {
......@@ -131,7 +131,7 @@ CAF_TEST(dynamic_stateful_actor_class) {
}
CAF_TEST(typed_stateful_actor_class) {
test_adder(spawn_typed<typed_adder_class>());
test_adder(spawn<typed_adder_class>());
}
CAF_TEST(no_name) {
......
......@@ -253,7 +253,7 @@ CAF_TEST_FIXTURE_SCOPE(atom_tests, fixture)
CAF_TEST(test_void_res) {
using testee_a = typed_actor<replies_to<int, int>::with<void>>;
auto buddy = spawn_typed([]() -> testee_a::behavior_type {
auto buddy = spawn([]() -> testee_a::behavior_type {
return [](int, int) {
// nop
};
......
......@@ -81,7 +81,7 @@ CAF_TEST_FIXTURE_SCOPE(typed_spawn_tests, fixture)
CAF_TEST(typed_response_promise) {
scoped_actor self;
auto foo = spawn_typed<foo_actor_impl>();
auto foo = spawn<foo_actor_impl>();
self->sync_send(foo, get_atom::value, 42).await(
[](int x) {
CAF_CHECK_EQUAL(x, 84);
......
......@@ -201,7 +201,7 @@ string_actor::behavior_type string_reverter() {
// uses `return sync_send(...).then(...)`
string_actor::behavior_type string_relay(string_actor::pointer self,
string_actor master, bool leaf) {
auto next = leaf ? spawn_typed(string_relay, master, false) : master;
auto next = leaf ? spawn(string_relay, master, false) : master;
self->link_to(next);
return {
[=](const string& str) {
......@@ -217,7 +217,7 @@ string_actor::behavior_type string_relay(string_actor::pointer self,
// uses `return delegate(...)`
string_actor::behavior_type string_delegator(string_actor::pointer self,
string_actor master, bool leaf) {
auto next = leaf ? spawn_typed(string_delegator, master, false) : master;
auto next = leaf ? spawn(string_delegator, master, false) : master;
self->link_to(next);
return {
[=](string& str) -> delegated<string> {
......@@ -326,16 +326,16 @@ CAF_TEST_FIXTURE_SCOPE(typed_spawn_tests, fixture)
CAF_TEST(typed_spawns) {
// run test series with typed_server(1|2)
test_typed_spawn(spawn_typed(typed_server1));
test_typed_spawn(spawn(typed_server1));
await_all_actors_done();
CAF_MESSAGE("finished test series with `typed_server1`");
test_typed_spawn(spawn_typed(typed_server2));
test_typed_spawn(spawn(typed_server2));
await_all_actors_done();
CAF_MESSAGE("finished test series with `typed_server2`");
{
scoped_actor self;
test_typed_spawn(spawn_typed<typed_server3>("hi there", self));
test_typed_spawn(spawn<typed_server3>("hi there", self));
self->receive(on("hi there") >> [] {
CAF_MESSAGE("received \"hi there\"");
});
......@@ -345,7 +345,7 @@ CAF_TEST(typed_spawns) {
CAF_TEST(test_event_testee) {
// run test series with event_testee
scoped_actor self;
auto et = self->spawn_typed<event_testee>();
auto et = self->spawn<event_testee>();
string result;
self->send(et, 1);
self->send(et, 2);
......@@ -385,8 +385,8 @@ CAF_TEST(reverter_relay_chain) {
// run test series with string reverter
scoped_actor self;
// actor-under-test
auto aut = self->spawn_typed<monitored>(string_relay,
spawn_typed(string_reverter),
auto aut = self->spawn<monitored>(string_relay,
spawn(string_reverter),
true);
set<string> iface{"caf::replies_to<@str>::with<@str>"};
CAF_CHECK(aut->message_types() == iface);
......@@ -402,8 +402,8 @@ CAF_TEST(string_delegator_chain) {
// run test series with string reverter
scoped_actor self;
// actor-under-test
auto aut = self->spawn_typed<monitored>(string_delegator,
spawn_typed(string_reverter),
auto aut = self->spawn<monitored>(string_delegator,
spawn(string_reverter),
true);
set<string> iface{"caf::replies_to<@str>::with<@str>"};
CAF_CHECK(aut->message_types() == iface);
......@@ -417,8 +417,8 @@ CAF_TEST(string_delegator_chain) {
CAF_TEST(maybe_string_delegator_chain) {
scoped_actor self;
auto aut = spawn_typed(maybe_string_delegator,
spawn_typed(maybe_string_reverter));
auto aut = spawn(maybe_string_delegator,
spawn(maybe_string_reverter));
self->sync_send(aut, "").await(
[](ok_atom, const string&) {
throw std::logic_error("unexpected result!");
......@@ -440,7 +440,7 @@ CAF_TEST(maybe_string_delegator_chain) {
CAF_TEST(test_sending_typed_actors) {
scoped_actor self;
auto aut = spawn_typed(int_fun);
auto aut = spawn(int_fun);
self->send(spawn(foo), 10, aut);
self->receive(
[](int i) { CAF_CHECK_EQUAL(i, 100); }
......@@ -450,7 +450,7 @@ CAF_TEST(test_sending_typed_actors) {
CAF_TEST(test_sending_typed_actors_and_down_msg) {
scoped_actor self;
auto aut = spawn_typed(int_fun2);
auto aut = spawn(int_fun2);
self->send(spawn(foo2), 10, aut);
self->receive([](int i) { CAF_CHECK_EQUAL(i, 100); });
}
......@@ -469,7 +469,7 @@ CAF_TEST(check_signature) {
};
};
auto bar_action = [=](bar_type::pointer self) -> bar_type::behavior_type {
auto foo = self->spawn_typed<linked>(foo_action);
auto foo = self->spawn<linked>(foo_action);
self->send(foo, put_atom::value);
return {
[=](ok_atom) {
......@@ -481,7 +481,7 @@ CAF_TEST(check_signature) {
};
};
scoped_actor self;
self->spawn_typed<monitored>(bar_action);
self->spawn<monitored>(bar_action);
self->receive(
[](const down_msg& dm) {
CAF_CHECK_EQUAL(dm.reason, exit_reason::normal);
......
......@@ -58,17 +58,17 @@ class typed_broker;
/// Infers the appropriate base class for a functor-based typed actor
/// from the result and the first argument of the functor.
template <class Result, class FirstArg>
struct infer_typed_broker_base;
struct CAF_DEPRECATED infer_typed_broker_base;
template <class... Sigs, class FirstArg>
struct infer_typed_broker_base<typed_behavior<Sigs...>, FirstArg> {
using type = typed_broker<Sigs...>;
};
} CAF_DEPRECATED;
template <class... Sigs>
struct infer_typed_broker_base<void, typed_event_based_actor<Sigs...>*> {
struct infer_typed_broker_base<void, typed_broker<Sigs...>*> {
using type = typed_broker<Sigs...>;
};
} CAF_DEPRECATED;
/// A typed broker mediates between actor systems and other components in
/// the network.
......@@ -166,22 +166,11 @@ public:
}
template <class F, class... Ts>
typename infer_typed_actor_handle<
typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types
>::type
>::type
typename infer_handle_from_fun<F>::type
fork(F fun, connection_handle hdl, Ts&&... xs) {
auto sptr = this->take(hdl);
CAF_ASSERT(sptr->hdl() == hdl);
using impl =
typename infer_typed_broker_base<
typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types
>::type
>::type;
using impl = typename infer_handle_from_fun<F>::impl;
static_assert(std::is_convertible<typename impl::actor_hdl,
minimal_client>::value,
"Cannot fork: new broker misses required handlers");
......
......@@ -72,7 +72,8 @@ intrusive_ptr<Impl> spawn_io_server_impl(F fun, uint16_t port, Ts&&... xs) {
/// Spawns a new functor-based broker.
template <spawn_options Os = no_spawn_options,
class F = std::function<void(broker*)>, class... Ts>
actor spawn_io(F fun, Ts&&... xs) {
typename infer_handle_from_fun<F>::type
spawn_io(F fun, Ts&&... xs) {
return spawn_functor<Os>(nullptr, empty_before_launch_callback{},
std::move(fun), std::forward<Ts>(xs)...);
}
......@@ -80,25 +81,29 @@ actor spawn_io(F fun, Ts&&... xs) {
/// Spawns a new functor-based broker connecting to `host:port`.
template <spawn_options Os = no_spawn_options,
class F = std::function<void(broker*)>, class... Ts>
actor spawn_io_client(F fun, const std::string& host,
typename infer_handle_from_fun<F>::type
spawn_io_client(F fun, const std::string& host,
uint16_t port, Ts&&... xs) {
return spawn_io_client_impl<Os, broker>(std::move(fun), host, port,
std::forward<Ts>(xs)...);
using impl = typename infer_handle_from_fun<F>::impl;
return spawn_io_client_impl<Os, impl>(std::move(fun), host, port,
std::forward<Ts>(xs)...);
}
/// Spawns a new broker as server running on given `port`.
template <spawn_options Os = no_spawn_options,
class F = std::function<void(broker*)>, class... Ts>
actor spawn_io_server(F fun, uint16_t port, Ts&&... xs) {
return spawn_io_server_impl<Os, broker>(std::move(fun), port,
std::forward<Ts>(xs)...);
typename infer_handle_from_fun<F>::type
spawn_io_server(F fun, uint16_t port, Ts&&... xs) {
using impl = typename infer_handle_from_fun<F>::impl;
return spawn_io_server_impl<Os, impl>(std::move(fun), port,
std::forward<Ts>(xs)...);
}
namespace experimental {
/// Spawns a new functor-based typed-broker.
template <spawn_options Os = no_spawn_options, class F, class... Ts>
typename infer_typed_actor_handle<
CAF_DEPRECATED typename infer_typed_actor_handle<
typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types
......@@ -119,7 +124,7 @@ spawn_io_typed(F fun, Ts&&... xs) {
/// Spawns a new functor-based typed-broker connecting to `host:port`.
template <spawn_options Os = no_spawn_options, class F, class... Ts>
typename infer_typed_actor_handle<
CAF_DEPRECATED typename infer_typed_actor_handle<
typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types
......@@ -140,7 +145,7 @@ spawn_io_client_typed(F fun, const std::string& host, uint16_t port,
/// Spawns a new typed-broker as server running on given `port`.
template <spawn_options Os = no_spawn_options, class F, class... Ts>
typename infer_typed_actor_handle<
CAF_DEPRECATED typename infer_typed_actor_handle<
typename detail::get_callable_trait<F>::result_type,
typename detail::tl_head<
typename detail::get_callable_trait<F>::arg_types
......@@ -160,7 +165,6 @@ spawn_io_server_typed(F fun, uint16_t port, Ts&&... xs) {
} // namespace experimental
} // namespace io
} // namespace caf
......
......@@ -270,7 +270,7 @@ void middleman::initialize() {
do_announce<new_connection_msg>("caf::io::new_connection_msg");
do_announce<new_data_msg>("caf::io::new_data_msg");
actor mgr = get_named_broker<basp_broker>(atom("_BASP"));
manager_ = spawn_typed<middleman_actor_impl, detached + hidden>(*this, mgr);
manager_ = spawn<middleman_actor_impl, detached + hidden>(*this, mgr);
}
void middleman::stop() {
......
......@@ -186,7 +186,7 @@ acceptor::behavior_type acceptor_fun(acceptor::broker_pointer self,
void run_server(bool spawn_client, const char* bin_path, bool use_asio) {
scoped_actor self;
auto serv = spawn_io_typed(acceptor_fun, spawn(pong));
auto serv = spawn_io(acceptor_fun, spawn(pong));
self->sync_send(serv, publish_atom::value).await(
[&](uint16_t port) {
CAF_MESSAGE("server is running on port " << port);
......@@ -233,7 +233,7 @@ CAF_TEST(test_typed_broker) {
if (r.opts.count("client-port") > 0) {
auto p = spawn(ping, 10);
CAF_MESSAGE("spawn_io_client_typed...");
auto cl = spawn_io_client_typed(peer_fun, "localhost", port, p);
auto cl = spawn_io_client(peer_fun, "localhost", port, p);
CAF_MESSAGE("spawn_io_client_typed finished");
anon_send(p, kickoff_atom::value, cl);
CAF_MESSAGE("`kickoff_atom` has been send");
......
......@@ -95,7 +95,7 @@ void run_client(const char* host, uint16_t port) {
}
uint16_t run_server() {
auto port = io::typed_publish(spawn_typed(server), 0, "127.0.0.1");
auto port = io::typed_publish(spawn(server), 0, "127.0.0.1");
CAF_MESSAGE("running on port " << port);
return port;
}
......
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