void abstract_broker::launch(execution_unit*, bool, bool is_hidden) { // add implicit reference count held by the middleman ref(); is_registered(! is_hidden); CAF_PUSH_AID(id()); CAF_LOGF_TRACE("init and launch broker with ID " << id()); // we want to make sure initialization is executed in MM context do_become( [=](sys_atom) { CAF_LOGF_TRACE("ID " << id()); bhvr_stack_.pop_back(); // launch backends now, because user-defined initialization // might call functions like add_connection for (auto& kvp : doormen_) { kvp.second->launch(); } initialize(); }, true); enqueue(invalid_actor_addr, invalid_message_id, make_message(sys_atom::value), nullptr); }
inline void local_actor::do_become(const behavior& bhvr, bool discard_old) { behavior copy{bhvr}; do_become(std::move(copy), discard_old); }
/** * @brief Sets the actor's behavior. */ inline void become(keep_behavior_t, behavior bhvr) { do_become(std::move(bhvr), false); }
/** * @brief Sets the actor's behavior to @p bhvr and keeps the * previous behavior, so that it can be restored by calling * {@link unbecome()}. * @note The recommended way of using this member function is to pass * a pointer to a member variable. * @warning @p bhvr is owned by the caller and must remain valid until * the actor terminates. */ inline void become(keep_behavior_t, behavior* bhvr) { do_become(*bhvr, false); }
/** * @brief Sets the actor's behavior. */ inline void become(discard_behavior_t, behavior bhvr) { do_become(std::move(bhvr), true); }
/** * @brief Sets the actor's behavior to @p bhvr and discards the * previous behavior. * @note The recommended way of using this member function is to pass * a pointer to a member variable. * @warning @p bhvr is owned by the caller and must remain valid until * the actor terminates. */ inline void become(discard_behavior_t, behavior* bhvr) { do_become(*bhvr, true); }