Skip to main content

class thread_queue

Declaration

class thread_queue { /* full declaration omitted */ };

Description

A single-thread job queue accepting functors and returning events that conditionally forward job results.

Member Variables

std::unique_ptr<impl> m_impl

Member Function Overview

Member Functions

thread_queue& operator=(const thread_queue&)

Parameters

const thread_queue&

thread_queue& operator=(thread_queue&&)

Parameters

thread_queue&&

template <typename Fn>
async_event submit(Fn&& fn)

Description

Submit a job to the thread queue. fn must take no arguments and return either void or a type convertible to void *, which will be forwarded as the result into the event.

Template Parameters

Fn

Parameters

Fn&& fn

thread_queue()

Description

Constructs a null thread queue that cannot receive jobs.


explicit thread_queue(
    std::string thread_name,
    bool enable_profiling = false)

Description

Spawns a new thread queue with the given thread name. If enable_profiling is set to true, completed events from this thread queue will report a non-nullopt duration.

Parameters

std::string thread_name
bool enable_profiling = false

thread_queue(const thread_queue&)

Parameters

const thread_queue&

thread_queue(thread_queue&&)

Parameters

thread_queue&&

~thread_queue()

Description

Destruction will await all submitted and pending jobs.