7#include "wfree_fifo.hpp"
8#include "functional.hpp"
9#include "../macros.hpp"
12namespace hi::inline
v1 {
23template<
typename Proto =
void(), std::
size_t SlotSize = 64>
26 constexpr function_fifo()
noexcept =
default;
27 function_fifo(function_fifo
const&) =
delete;
28 function_fifo(function_fifo&&) =
delete;
29 function_fifo& operator=(function_fifo
const&) =
delete;
30 function_fifo& operator=(function_fifo&&) =
delete;
34 [[nodiscard]]
bool empty() const noexcept
44 template<
typename... Args>
47 return _fifo.take_one([&args...](
auto& item) {
48 return item(hi_forward(args)...);
69 template<
typename Func>
85 template<
typename Func,
typename... Args>
87 requires(std::is_invocable_v<std::decay_t<Func>, std::decay_t<Args>...>)
89 return _fifo.insert_and_invoke(
91 return item.get_future();
DOXYGEN BUG.
Definition algorithm.hpp:16
void run_all() noexcept
Run all the functions posted or send on the fifo.
Definition function_fifo.hpp:56
void add_function(Func &&func) noexcept
Asynchronously post a functor to the fifo to be executed later.
Definition function_fifo.hpp:70
auto add_async_function(Func &&func, Args &&...args) noexcept
Asynchronously send a functor to the fifo to be executed later.
Definition function_fifo.hpp:86
auto run_one(Args &&...args) noexcept
Run one of the function that was posted or send.
Definition function_fifo.hpp:45
bool empty() const noexcept
Check if there are not functions added to the fifo.
Definition function_fifo.hpp:34
A wait-free multiple-producer/single-consumer fifo designed for absolute performance.
Definition wfree_fifo.hpp:36