Seastar
High performance C++ framework for concurrent servers
Public Member Functions | List of all members
seastar::inheriting_concrete_execution_stage< ReturnType, Args > Class Template Referencefinal

Detailed Description

template<typename ReturnType, typename... Args>
class seastar::inheriting_concrete_execution_stage< ReturnType, Args >

Concrete execution stage class, with support for automatic scheduling_group inheritance.

A variation of concrete_execution_stage that inherits the scheduling_group from the caller. Each call (of operator()) can be in its own scheduling group.

Template Parameters
ReturnTypereturn type of the function object
Argsargument pack containing arguments to the function object, needs to have move constructor that doesn't throw

#include <seastar/core/execution_stage.hh>

Public Member Functions

 inheriting_concrete_execution_stage (const sstring &name, noncopyable_function< ReturnType(Args...)> f)
 
return_type operator() (typename internal::wrap_for_es< Args >::type... args)
 

Constructor & Destructor Documentation

◆ inheriting_concrete_execution_stage()

template<typename ReturnType , typename... Args>
seastar::inheriting_concrete_execution_stage< ReturnType, Args >::inheriting_concrete_execution_stage ( const sstring &  name,
noncopyable_function< ReturnType(Args...)>  f 
)
inline

Construct an inheriting concrete execution stage.

Parameters
nameA name for the execution stage; must be unique
fFunction to be called in response to operator(). The function call will be deferred and batched with similar calls to increase instruction cache hit rate.

Member Function Documentation

◆ operator()()

template<typename ReturnType , typename... Args>
return_type seastar::inheriting_concrete_execution_stage< ReturnType, Args >::operator() ( typename internal::wrap_for_es< Args >::type...  args)
inline

Enqueues a call to the stage's function

Adds a function call to the queue. Objects passed by value are moved, rvalue references are decayed and the objects are moved, lvalue references need to be explicitly wrapped using seastar::ref().

The caller's scheduling_group will be preserved across the call.

Usage example:

void do_something(int);
thread_local auto stage = seastar::inheriting_concrete_execution_stage<int>("execution-stage", do_something);
future<> func(int x) {
return stage(x);
}
Parameters
argsarguments passed to the stage's function
Returns
future containing the result of the call to the stage's function

The documentation for this class was generated from the following file:
seastar::inheriting_concrete_execution_stage
Concrete execution stage class, with support for automatic scheduling_group inheritance.
Definition: execution_stage.hh:313