Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

make_trampoline (1 of 2 overloads)

Create a trampoline object for an executor.

template<
    typename Executor,
      = constraint_t<      is_executor<Executor>::value || execution::is_executor<Executor>::value    >>
trampoline< Executor > make_trampoline(
    const Executor & ex,
    std::size_t calls,
    std::size_t max_inline_depth = 0);
Parameters

ex

The target executor.

calls

The maximum number of additional calls (i.e. excluding the call that installs the trampoline) that can be run on the trampoline, if the returned executor installs the trampoline. Pass (std::numeric_limits<std::size_t>::max)() to specify that the trampoline places no bound on the number of calls.

max_inline_depth

The deepest a blocking.possibly execute() made from inside this trampoline's own frame may run immediately rather than queue, counting the nesting of such immediate calls already underway. A nested function that runs this way runs before the remainder of its caller, ahead of whatever is already queued on the frame. It still spends one of calls, the same as a queued call. A value of 0, the default, preserves today's behaviour: every dispatched function queues and runs only as the frame is drained.

Exceptions

std::out_of_range

if max_inline_depth is greater than 255.

Return Value

A trampoline constructed with the specified executor, and a freshly allocated identity. Passing an existing trampoline as ex is not a special case. As with make_strand wrapping an existing strand, it creates a new trampoline, with its own fresh identity, over that one as its target. The two do not join each other's trampolines.


PrevUpHomeNext