| 95 | // Send a message from one actor to another. |
| 96 | template <class Message> |
| 97 | friend void send(Message msg, actor_address from, actor_address to) |
| 98 | { |
| 99 | // Execute the message handler in the context of the target's executor. |
| 100 | post(to->executor_, |
| 101 | [=, msg=std::move(msg)]() mutable |
| 102 | { |
| 103 | to->call_handler(std::move(msg), from); |
| 104 | }); |
| 105 | } |
| 106 | |
| 107 | protected: |
| 108 | // Construct the actor to use the specified executor for all message handlers. |