void actor_manager::broadcast_message(module_id sender,message& msg) { assert(msg.get_type() != EMessageType::Unknown); msg.set_sender(sender); msg.set_receiver(module_id::create(0)); for (auto& w : _workers) { w->broadcast_message(msg); } }
void actor_manager::send_message(module_id sender, module_id receiver,message& msg) { assert(msg.get_type() != EMessageType::Unknown); msg.set_sender(sender); msg.set_receiver(receiver); uint8_t workerID = get_workerID(receiver); if (workerID < _workers.size()) { _workers[workerID]->dispatch_message(msg); } }
void actor::send_message( module_id receiver,message& msg) { //if send self message , add to message queue directly. if (receiver == get_id()) { msg.set_sender(get_id()); msg.set_receiver(get_id()); add_message(msg); return; } _Imp->mgr->send_message(get_id(), receiver, msg); }