Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

make_trampoline (2 of 2 overloads)

Create a trampoline object for an execution context.

template<
    typename ExecutionContext,
      = constraint_t<      is_convertible<ExecutionContext&, execution_context&>::value    >>
trampoline< typename ExecutionContext::executor_type > make_trampoline(
    ExecutionContext & ctx,
    std::size_t calls,
    std::size_t max_inline_depth = 0);
Parameters

ctx

An execution context, from which an executor will be obtained.

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 execution context's executor, obtained by performing ctx.get_executor(), and a freshly allocated identity.


PrevUpHomeNext