C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::detail::default_mailbox Class Reference

Our default mailbox implementation. More...

#include <default_mailbox.hpp>

Inheritance diagram for caf::detail::default_mailbox:
caf::abstract_mailbox

Public Member Functions

 default_mailbox (const default_mailbox &)=delete
 
default_mailboxoperator= (const default_mailbox &)=delete
 
mailbox_element * peek (message_id id) override
 
intrusive::inbox_result push_back (mailbox_element_ptr ptr) override
 Adds a new element to the mailbox.
 
void push_front (mailbox_element_ptr ptr) override
 Adds a new element to the mailbox by putting it in front of the queue.
 
mailbox_element_ptr pop_front () override
 Removes the next element from the mailbox.
 
bool closed () const noexcept override
 Checks whether the mailbox has been closed.
 
bool blocked () const noexcept override
 Checks whether the owner of this mailbox is currently waiting for new messages.
 
bool try_block () override
 Tries to put the mailbox in a blocked state.
 
bool try_unblock () override
 Tries to put the mailbox in an empty state from a blocked state.
 
size_t close (const error &) override
 Closes the mailbox and discards all pending messages.
 
size_t size () override
 Returns the number of pending messages.
 
void ref_mailbox () noexcept override
 Increases the reference count by one.
 
void deref_mailbox () noexcept override
 Decreases the reference count by one and deletes this instance if the reference count drops to zero.
 
size_t ref_count () const noexcept
 
- Public Member Functions inherited from caf::abstract_mailbox
bool empty ()
 Checks whether the mailbox is empty.
 

Detailed Description

Our default mailbox implementation.

Uses a LIFO inbox for storing incoming messages and combines it with two FIFO caches for storing urgent and normal messages.

Member Function Documentation

◆ blocked()

bool caf::detail::default_mailbox::blocked ( ) const
overridevirtualnoexcept

Checks whether the owner of this mailbox is currently waiting for new messages.

Note
Only the owning actor is allowed to call this function.

Implements caf::abstract_mailbox.

◆ close()

size_t caf::detail::default_mailbox::close ( const error & reason)
overridevirtual

Closes the mailbox and discards all pending messages.

Returns
The number of dropped messages.
Note
Only the owning actor is allowed to call this function.

Implements caf::abstract_mailbox.

◆ closed()

bool caf::detail::default_mailbox::closed ( ) const
overridevirtualnoexcept

Checks whether the mailbox has been closed.

Note
Only the owning actor is allowed to call this function.

Implements caf::abstract_mailbox.

◆ deref_mailbox()

void caf::detail::default_mailbox::deref_mailbox ( )
overridevirtualnoexcept

Decreases the reference count by one and deletes this instance if the reference count drops to zero.

Implements caf::abstract_mailbox.

◆ peek()

mailbox_element * caf::detail::default_mailbox::peek ( message_id id)
overridevirtual
Note
Only used by the legacy test framework. Remove when dropping support for it.

Implements caf::abstract_mailbox.

◆ pop_front()

mailbox_element_ptr caf::detail::default_mailbox::pop_front ( )
overridevirtual

Removes the next element from the mailbox.

Returns
The next element in the mailbox or nullptr if the mailbox is empty.
Note
Only the owning actor is allowed to call this function.

Implements caf::abstract_mailbox.

◆ push_back()

intrusive::inbox_result caf::detail::default_mailbox::push_back ( mailbox_element_ptr ptr)
overridevirtual

Adds a new element to the mailbox.

Returns
inbox_result::success if the element has been added to the mailbox, inbox_result::unblocked_reader if the reader has been unblocked, or inbox_result::queue_closed if the mailbox has been closed. @threadsafe

Implements caf::abstract_mailbox.

◆ push_front()

void caf::detail::default_mailbox::push_front ( mailbox_element_ptr ptr)
overridevirtual

Adds a new element to the mailbox by putting it in front of the queue.

Note
Only the owning actor is allowed to call this function.

Implements caf::abstract_mailbox.

◆ ref_mailbox()

void caf::detail::default_mailbox::ref_mailbox ( )
overridevirtualnoexcept

Increases the reference count by one.

Implements caf::abstract_mailbox.

◆ size()

size_t caf::detail::default_mailbox::size ( )
overridevirtual

Returns the number of pending messages.

Note
Only the owning actor is allowed to call this function.

Implements caf::abstract_mailbox.

◆ try_block()

bool caf::detail::default_mailbox::try_block ( )
overridevirtual

Tries to put the mailbox in a blocked state.

Note
Only the owning actor is allowed to call this function.

Implements caf::abstract_mailbox.

◆ try_unblock()

bool caf::detail::default_mailbox::try_unblock ( )
overridevirtual

Tries to put the mailbox in an empty state from a blocked state.

Note
Only the owning actor is allowed to call this function.

Implements caf::abstract_mailbox.


The documentation for this class was generated from the following files: