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);
}
示例#2
0
inline void local_actor::do_become(const behavior& bhvr, bool discard_old) {
    behavior copy{bhvr};
    do_become(std::move(copy), discard_old);
}
示例#3
0
 /**
  * @brief Sets the actor's behavior.
  */
 inline void become(keep_behavior_t, behavior bhvr) {
     do_become(std::move(bhvr), false);
 }
示例#4
0
 /**
  * @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);
 }
示例#5
0
 /**
  * @brief Sets the actor's behavior.
  */
 inline void become(discard_behavior_t, behavior bhvr) {
     do_become(std::move(bhvr), true);
 }
示例#6
0
 /**
  * @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);
 }