inline void bind( self_t sire, std::string const& ep, /// endpoint bool is_router = false, /// if this bind is router, set it true remote_func_list_t const& remote_func_list = remote_func_list_t(), net_option opt = net_option() ) { detail::cache_pool* user = 0; detail::cache_pool* owner = sire.get_cache_pool(); detail::bind(user, owner, ep, is_router, remote_func_list, opt); }
inline void connect( self_t sire, ctxid_t target, /// connect target std::string const& ep, /// endpoint bool target_is_router = false, /// if target is router, set it true net_option opt = net_option(), remote_func_list_t const& remote_func_list = remote_func_list_t() ) { detail::cache_pool* user = 0; detail::cache_pool* owner = sire.get_cache_pool(); detail::connect(user, owner, target, ep, target_is_router, remote_func_list, opt); }
static void my_actor(self_t self, aid_t base) { std::size_t loop_num = 10; yield_t yield = self.get_yield(); timer_t tmr(self.get_cache_pool()->get_context().get_io_service()); for (std::size_t i=0; i<loop_num; ++i) { send(self, base, atom("echo")); recv(self, atom("echo")); tmr.expires_from_now(boost::chrono::milliseconds(1)); tmr.async_wait(yield); } }