///----------------------------------------------------------------------------
aid_t coroutine_stackful_actor::recv(response_t res, message& msg, duration_t tmo)
{
  aid_t sender;

  recving_res_ = res;
  if (!mb_.pop(res, msg))
  {
    if (tmo > zero)
    {
      detail::scoped_bool<bool> scp(responsing_);
      if (tmo < infin)
      {
        start_recv_timer(tmo);
      }
      actor_code ac = yield();
      if (ac == actor_timeout)
      {
        return sender;
      }

      res = recving_res_;
      msg = recving_msg_;
      recving_res_ = response_t();
      recving_msg_ = message();
    }
    else
    {
      return sender;
    }
  }

  sender = res.get_aid();
  return sender;
}
Esempio n. 2
0
///----------------------------------------------------------------------------
aid_t slice::recv(response_t res, message& msg)
{
  aid_t sender;

  mixin::move_pack(this, mb_, pack_que_, user_, sire_);
  if (!mb_.pop(res, msg))
  {
    return sender;
  }

  sender = res.get_aid();
  return sender;
}