Loading...
Searching...
No Matches
caf::intrusive::lifo_inbox< Policy > 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 | policy_type = Policy
using | value_type = typename policy_type::mapped_type
using | pointer = value_type*
using | node_type = typename value_type::node_type
using | node_pointer = node_type*
using | unique_pointer = typename policy_type::unique_pointer
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 () noexcept
| Closes this queue and deletes all remaining elements.
template<class F>
void | close (F &f) noexcept(noexcept(f(std::declval< pointer >())))
| Closes this queue and applies f to each pointer.
template<class Mutex, class CondVar>
bool | synchronized_push_front (Mutex &mtx, CondVar &cv, pointer ptr)
template<class Mutex, class CondVar>
bool | synchronized_push_front (Mutex &mtx, CondVar &cv, unique_pointer ptr)
template<class Mutex, class CondVar, class... Ts>
bool | synchronized_emplace_front (Mutex &mtx, CondVar &cv, Ts &&... xs)
template<class Mutex, class CondVar>
void | synchronized_await (Mutex &mtx, CondVar &cv)
template<class Mutex, class CondVar, class TimePoint>
bool | synchronized_await (Mutex &mtx, CondVar &cv, const TimePoint &timeout)

## Static Public Member Functions

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

## Detailed Description

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

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

## Member Function Documentation

## close() [1/2]

template<class Policy>

void caf::intrusive::lifo_inbox< Policy >::close | ( |  | ) |

noexcept

Closes this queue and deletes all remaining elements.

Warning
  Call only from the reader (owner).

## close() [2/2]

template<class Policy>
template<class F>

void caf::intrusive::lifo_inbox< Policy >::close | ( | F & | f | ) |

noexcept

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 Policy>
template<class... Ts>

inbox_result caf::intrusive::lifo_inbox< Policy >::emplace_front | ( | Ts &&... | xs | ) |

Tries to enqueue a new element to the mailbox.

@threadsafe

## empty()

template<class Policy>

bool caf::intrusive::lifo_inbox< Policy >::empty | ( |  | ) | const

noexcept

Queries whether this queue is empty.

Precondition
  !closed() && !blocked()

## push_front() [1/2]

template<class Policy>

inbox_result caf::intrusive::lifo_inbox< Policy >::push_front | ( | pointer | new_element | ) |

noexcept

Tries to enqueue a new element to the inbox.

@threadsafe

## push_front() [2/2]

template<class Policy>

inbox_result caf::intrusive::lifo_inbox< Policy >::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:

- /build/actor-framework-Z9pIPl/actor-framework-0.17.6/libcaf_core/caf/intrusive/lifo_inbox.hpp