stlab 2.3.0
Modern, modular C++ algorithms, data structures, and concurrency primitives
Loading...
Searching...
No Matches
stlab::serial_queue_t Class Reference

Executor wrapper that runs enqueued tasks serially on top of e. More...

#include <serial_queue.hpp>

Public Member Functions

template<typename Executor>
 serial_queue_t (Executor e, schedule_mode mode=schedule_mode::single)
 Constructs a serial queue using underlying executor e and drain mode mode.
auto executor () const
 Returns an executor that enqueues void() noexcept tasks on this queue.
template<typename F, typename... Args>
auto operator() (F &&f, Args &&... args) const
 Schedules f(args...) on this queue via async and returns the resulting future.

Detailed Description

Executor wrapper that runs enqueued tasks serially on top of e.

Member Function Documentation

◆ executor()

auto stlab::serial_queue_t::executor ( ) const
inlinenodiscard

Returns an executor that enqueues void() noexcept tasks on this queue.

Like other executors, operator() returns void — tasks are not cancelable and no future carries their result. Suitable for fire-and-forget work on the serial context.

◆ operator()()

template<typename F, typename... Args>
auto stlab::serial_queue_t::operator() ( F && f,
Args &&... args ) const
inline

Schedules f(args...) on this queue via async and returns the resulting future.

Retain the returned future until the task completes; destroying it early cancels work that has not yet run.


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