コード例 #1
0
 typename detail::deduce_output_type<
   detail::type_list<Sigs...>,
   detail::type_list<
     typename detail::implicit_conversions<
       typename std::decay<Ts>::type
     >::type...
   >
 >::delegated_type
 delegate(message_priority mp, const typed_actor<Sigs...>& dest, Ts&&... xs) {
   static_assert(sizeof...(Ts) > 0, "no message to send");
   using token =
     detail::type_list<
       typename detail::implicit_conversions<
         typename std::decay<Ts>::type
       >::type...>;
   token tk;
   check_typed_input(dest, tk);
   if (! dest)
     return {};
   auto mid = current_element_->mid;
   current_element_->mid = mp == message_priority::high
                            ? mid.with_high_priority()
                            : mid.with_normal_priority();
   current_element_->msg = make_message(std::forward<Ts>(xs)...);
   dest->enqueue(std::move(current_element_), host());
   return {};
 }
コード例 #2
0
ファイル: local_actor.cpp プロジェクト: ajac/libcppa
message_id local_actor::sync_send_tuple_impl(message_priority mp,
                                             const actor& dest,
                                             any_tuple&& what) {
    auto nri = new_request_id();
    if (mp == message_priority::high) nri = nri.with_high_priority();
    dest->enqueue({address(), dest, nri}, std::move(what));
    return nri.response_id();
}
コード例 #3
0
 void delegate(message_priority mp, const actor& dest, Ts&&... xs) {
   static_assert(sizeof...(Ts) > 0, "no message to send");
   if (! dest)
     return;
   auto mid = current_element_->mid;
   current_element_->mid = mp == message_priority::high
                            ? mid.with_high_priority()
                            : mid.with_normal_priority();
   current_element_->msg = make_message(std::forward<Ts>(xs)...);
   dest->enqueue(std::move(current_element_), host());
 }
コード例 #4
0
ファイル: local_actor.cpp プロジェクト: ras0219/libcppa
message_id local_actor::sync_send_tuple_impl(message_priority mp,
                                             const actor& dest,
                                             any_tuple&& what) {
    if (!dest) {
        throw std::invalid_argument("cannot send synchronous message "
                                    "to invalid_actor");
    }
    auto nri = new_request_id();
    if (mp == message_priority::high) nri = nri.with_high_priority();
    dest->enqueue({address(), dest, nri}, std::move(what), m_host);
    return nri.response_id();
}
コード例 #5
0
ファイル: local_actor.cpp プロジェクト: ajac/libcppa
message_id local_actor::timed_sync_send_tuple_impl(message_priority mp,
                                                   const actor& dest,
                                                   const util::duration& rtime,
                                                   any_tuple&& what) {
    auto nri = new_request_id();
    if (mp == message_priority::high) nri = nri.with_high_priority();
    dest->enqueue({address(), dest, nri}, std::move(what));
    auto rri = nri.response_id();
    get_scheduler()->delayed_send({address(), this, rri}, rtime,
                                  make_any_tuple(sync_timeout_msg{}));
    return rri;
}
コード例 #6
0
ファイル: local_actor.cpp プロジェクト: ras0219/libcppa
message_id local_actor::timed_sync_send_tuple_impl(message_priority mp,
                                                   const actor& dest,
                                                   const util::duration& rtime,
                                                   any_tuple&& what) {
    if (!dest) {
        throw std::invalid_argument("cannot send synchronous message "
                                    "to invalid_actor");
    }
    auto nri = new_request_id();
    if (mp == message_priority::high) nri = nri.with_high_priority();
    dest->enqueue({address(), dest, nri}, std::move(what), m_host);
    auto rri = nri.response_id();
    get_scheduling_coordinator()->delayed_send({address(), this, rri}, rtime,
                                  make_any_tuple(sync_timeout_msg{}));
    return rri;
}
コード例 #7
0
message_id local_actor::timed_sync_send_tuple_impl(message_priority mp,
                                                   const actor& dest,
                                                   const duration& rtime,
                                                   message&& what) {
  if (!dest) {
    throw std::invalid_argument(
      "cannot send synchronous message "
      "to invalid_actor");
  }
  auto nri = new_request_id();
  if (mp == message_priority::high) {
    nri = nri.with_high_priority();
  }
  dest->enqueue(address(), nri, std::move(what), host());
  auto rri = nri.response_id();
  auto sched_cd = detail::singletons::get_scheduling_coordinator();
  sched_cd->delayed_send(rtime, address(), this, rri,
                         make_message(sync_timeout_msg{}));
  return rri;
}
コード例 #8
0
 typename response_type<
   typename Handle::signatures,
   detail::implicit_conversions_t<typename std::decay<Ts>::type>...
 >::delegated_type
 delegate(const Handle& dest, Ts&&... xs) {
   static_assert(sizeof...(Ts) > 0, "nothing to delegate");
   using token =
     detail::type_list<
       typename detail::implicit_conversions<
         typename std::decay<Ts>::type
       >::type...>;
   static_assert(response_type_unbox<signatures_of_t<Handle>, token>::valid,
                 "receiver does not accept given message");
   auto mid = current_element_->mid;
   current_element_->mid = P == message_priority::high
                           ? mid.with_high_priority()
                           : mid.with_normal_priority();
   dest->enqueue(make_mailbox_element(std::move(current_element_->sender),
                                      mid, std::move(current_element_->stages),
                                      std::forward<Ts>(xs)...),
                 context());
   return {};
 }