コード例 #1
0
 void operator()(actor_system&, uplock& guard, const actor_vec& vec,
                 mailbox_element_ptr& ptr, execution_unit* host) {
   CAF_ASSERT(!vec.empty());
   actor selected = vec[pos_++ % vec.size()];
   guard.unlock();
   selected->enqueue(std::move(ptr), host);
 }
コード例 #2
0
 void operator()(actor_system&, uplock& guard, const actor_vec& vec,
                 mailbox_element_ptr& ptr, execution_unit* host) {
   upgrade_to_unique_lock<detail::shared_spinlock> unique_guard{guard};
   auto selected =
       vec[dis_(rd_, decltype(dis_)::param_type(0, vec.size() - 1))];
   unique_guard.unlock();
   selected->enqueue(std::move(ptr), host);
 }
コード例 #3
0
ファイル: actor_pool.cpp プロジェクト: Jenuce/actor-framework
 void operator()(uplock& guard, const actor_vec& vec,
                 mailbox_element_ptr& ptr, execution_unit* host) {
   std::uniform_int_distribution<size_t> dis(0, vec.size() - 1);
   upgrade_to_unique_lock<detail::shared_spinlock> unique_guard{guard};
   actor selected = vec[dis(rd_)];
   unique_guard.unlock();
   selected->enqueue(std::move(ptr), host);
 }