本文整理汇总了C++中actor::enqueue方法的典型用法代码示例。如果您正苦于以下问题:C++ actor::enqueue方法的具体用法?C++ actor::enqueue怎么用?C++ actor::enqueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类actor
的用法示例。
在下文中一共展示了actor::enqueue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_message
void send_message(actor& source, actor& target, const std::string& message)
{
ac_message_t msg;
msg.src = &source;
msg.message = message;
target.enqueue(msg);
}
示例2: sync_send_tuple_impl
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: forward_message
void local_actor::forward_message(const actor& dest, message_priority prio) {
if (!dest) {
return;
}
auto id = (prio == message_priority::high)
? m_current_node->mid.with_high_priority()
: m_current_node->mid.with_normal_priority();
dest->enqueue(m_current_node->sender, id, m_current_node->msg, host());
// treat this message as asynchronous message from now on
m_current_node->mid = invalid_message_id;
}
示例4: delegate
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());
}
示例5: sync_send_tuple_impl
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();
}
示例6: timed_sync_send_tuple_impl
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;
}
示例7: timed_sync_send_tuple_impl
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;
}
示例8: timed_sync_send_tuple_impl
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;
}