C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::intrusive::lifo_inbox< T > Class Template Reference

An intrusive, thread-safe LIFO queue implementation for a single reader with any number of writers. More...

#include <lifo_inbox.hpp>

Public Types

using value_type = T
 
using pointer = value_type*
 
using node_type = typename value_type::node_type
 
using node_pointer = node_type*
 
using unique_pointer = std::unique_ptr<value_type>
 
using deleter_type = typename unique_pointer::deleter_type
 

Public Member Functions

inbox_result push_front (pointer new_element) noexcept
 Tries to enqueue a new element to the inbox.
 
inbox_result push_front (unique_pointer x) noexcept
 Tries to enqueue a new element to the inbox.
 
template<class... Ts>
inbox_result emplace_front (Ts &&... xs)
 Tries to enqueue a new element to the mailbox.
 
bool empty () const noexcept
 Queries whether this queue is empty.
 
bool closed () const noexcept
 Queries whether this has been closed.
 
bool blocked () const noexcept
 Queries whether this has been marked as blocked, i.e., the owner of the list is waiting for new data.
 
bool try_block () noexcept
 Tries to set this queue from empty to blocked.
 
bool try_unblock () noexcept
 Tries to set this queue from blocked to empty.
 
pointer take_head (pointer new_head) noexcept
 Sets the head to new_head and returns the previous head if the queue was not empty.
 
pointer take_head () noexcept
 Sets the head to stack_empty_tag() and returns the previous head if the queue was not empty.
 
void close ()
 Closes this queue and deletes all remaining elements.
 
template<class F >
void close (F &&f)
 Closes this queue and applies f to each pointer.
 

Static Public Member Functions

static pointer promote (node_pointer ptr) noexcept
 Casts a node type to its value type.
 

Detailed Description

template<class T>
class caf::intrusive::lifo_inbox< T >

An intrusive, thread-safe LIFO queue implementation for a single reader with any number of writers.

Member Function Documentation

◆ close() [1/2]

template<class T >
void caf::intrusive::lifo_inbox< T >::close ( )

Closes this queue and deletes all remaining elements.

Warning
Call only from the reader (owner).

◆ close() [2/2]

template<class T >
template<class F >
void caf::intrusive::lifo_inbox< T >::close ( F && f)

Closes this queue and applies f to each pointer.

The function object f must take ownership of the passed pointer.

Warning
Call only from the reader (owner).

◆ emplace_front()

template<class T >
template<class... Ts>
inbox_result caf::intrusive::lifo_inbox< T >::emplace_front ( Ts &&... xs)

Tries to enqueue a new element to the mailbox.

@threadsafe

◆ empty()

template<class T >
bool caf::intrusive::lifo_inbox< T >::empty ( ) const
noexcept

Queries whether this queue is empty.

Precondition
!closed() && !blocked()

◆ push_front() [1/2]

template<class T >
inbox_result caf::intrusive::lifo_inbox< T >::push_front ( pointer new_element)
noexcept

Tries to enqueue a new element to the inbox.

@threadsafe

◆ push_front() [2/2]

template<class T >
inbox_result caf::intrusive::lifo_inbox< T >::push_front ( unique_pointer x)
noexcept

Tries to enqueue a new element to the inbox.

@threadsafe


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