|
CAF 0.17.6
|
An co-existing actor forwarding all messages through a user-defined callback to another object, thus serving as gateway to allow any object to interact with other actors. More...
#include <actor_companion.hpp>
Inherits local_actor, and extend:: with< mixin::sender, mixin::subscriber, mixin::behavior_changer >.
Public Types | |
| using | signatures = none_t |
Required by spawn for type deduction. | |
| using | behavior_type = behavior |
Required by spawn for type deduction. | |
| using | lock_type = detail::shared_spinlock |
| A shared lockable. | |
| using | enqueue_handler = std::function< void(mailbox_element_ptr)> |
| Delegates incoming messages to user-defined event loop. | |
| using | on_exit_handler = std::function< void()> |
| Callback for actor termination. | |
Public Member Functions | |
| actor_companion (actor_config &cfg) | |
| void | enqueue (mailbox_element_ptr ptr, execution_unit *host) override |
| void | enqueue (strong_actor_ptr src, message_id mid, message content, execution_unit *eu) override |
| void | launch (execution_unit *eu, bool lazy, bool hide) override |
| void | on_exit () override |
| void | disconnect (exit_reason rsn=exit_reason::normal) |
Removes the handler for incoming messages and terminates the companion for exit reason rsn. | |
| void | on_enqueue (enqueue_handler handler) |
| Sets the handler for incoming messages. | |
| void | on_exit (on_exit_handler handler) |
| Sets the handler for incoming messages. | |
An co-existing actor forwarding all messages through a user-defined callback to another object, thus serving as gateway to allow any object to interact with other actors.
| void caf::actor_companion::on_enqueue | ( | enqueue_handler | handler | ) |
Sets the handler for incoming messages.
handler needs to be thread-safe