|
libcaf
0.16.3
|
A thread-mapped or context-switching actor using a blocking receive rather than a behavior-stack based message processing. More...
#include <blocking_actor.hpp>
Inherits local_actor, with< mixin::requester, mixin::sender, mixin::subscriber >, and caf::dynamically_typed_actor_base.
Classes | |
| class | accept_one_cond |
| Pseudo receive condition modeling a single receive. More... | |
| struct | do_receive_helper |
Implementation helper for blocking_actor::do_receive. More... | |
| struct | mailbox_policy |
| Configures the FIFO inbox with two nested queues: More... | |
| class | receive_cond |
| Represents pre- and postconditions for receive loops. More... | |
| struct | receive_for_helper |
Implementation helper for blocking_actor::receive_for. More... | |
| struct | receive_while_helper |
Implementation helper for blocking_actor::receive_while. More... | |
Public Types | |
| using | super = extended_base |
| Base type. | |
| using | normal_queue = intrusive::drr_cached_queue< policy::normal_messages > |
| Stores asynchronous messages with default priority. | |
| using | urgent_queue = intrusive::drr_cached_queue< policy::urgent_messages > |
| Stores asynchronous messages with hifh priority. | |
| using | mailbox_type = intrusive::fifo_inbox< mailbox_policy > |
| A queue optimized for single-reader-many-writers. | |
| using | timeout_type = std::chrono::high_resolution_clock::time_point |
| Absolute timeout type. | |
| using | behavior_type = behavior |
| Supported behavior type. | |
| using | signatures = none_t |
| Declared message passing interface. | |
Public Member Functions | |
| blocking_actor (actor_config &cfg) | |
| void | enqueue (mailbox_element_ptr, execution_unit *) override |
| const char * | name () const override |
| void | launch (execution_unit *eu, bool lazy, bool hide) override |
| virtual void | act () |
| Implements the actor's behavior. | |
| template<class... Ts> | |
| void | receive (Ts &&... xs) |
| Dequeues the next message from the mailbox that is matched by given behavior. | |
| template<class T > | |
| receive_for_helper< T > | receive_for (T &begin, T end) |
Receives messages for range [begin, first). More... | |
| receive_while_helper | receive_while (std::function< bool()> stmt) |
Receives messages as long as stmt returns true. More... | |
| receive_while_helper | receive_while (const bool &ref) |
Receives messages as long as ref is true. More... | |
| template<class... Ts> | |
| do_receive_helper | do_receive (Ts &&... xs) |
Receives messages until stmt returns true. More... | |
| void | await_all_other_actors_done () |
| Blocks this actor until all other actors are done. | |
| template<class... Ts> | |
| void | wait_for (Ts &&... xs) |
Blocks this actor until all xs... have terminated. | |
| void | fail_state (error err) |
Sets a user-defined exit reason err. More... | |
| virtual void | await_data () |
| Blocks until at least one message is in the mailbox. | |
| virtual bool | await_data (timeout_type timeout) |
Blocks until at least one message is in the mailbox or the absolute timeout was reached. | |
| virtual mailbox_element_ptr | dequeue () |
Returns the next element from the mailbox or nullptr. | |
| mailbox_type & | mailbox () |
| Returns the queue for storing incoming messages. | |
A thread-mapped or context-switching actor using a blocking receive rather than a behavior-stack based message processing.
| do_receive_helper caf::blocking_actor::do_receive | ( | Ts &&... | xs | ) |
Receives messages until stmt returns true.
Semantically equal to: do { receive(...); } while (stmt() == false);
Usage example:
| void caf::blocking_actor::fail_state | ( | error | err | ) |
Sets a user-defined exit reason err.
This reason is signalized to other actors after act() returns.
| receive_for_helper<T> caf::blocking_actor::receive_for | ( | T & | begin, |
| T | end | ||
| ) |
Receives messages for range [begin, first).
Semantically equal to: for ( ; begin != end; ++begin) { receive(...); }.
Usage example:
| receive_while_helper caf::blocking_actor::receive_while | ( | const bool & | ref | ) |
Receives messages as long as ref is true.
Semantically equal to: while (ref) { receive(...); }.
Usage example:
| receive_while_helper caf::blocking_actor::receive_while | ( | std::function< bool()> | stmt | ) |
Receives messages as long as stmt returns true.
Semantically equal to: while (stmt()) { receive(...); }.
Usage example:
1.8.16