Seastar
High performance C++ framework for concurrent servers
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
seastar::smp Class Reference
Inheritance diagram for seastar::smp:

Public Member Functions

 smp (alien::instance &alien)
 
void configure (const smp_options &smp_opts, const reactor_options &reactor_opts)
 
void cleanup () noexcept
 
void cleanup_cpu ()
 
void arrive_at_event_loop_end ()
 
void join_all ()
 

Static Public Member Functions

static bool main_thread ()
 
template<typename Func >
static futurize_t< std::invoke_result_t< Func > > submit_to (unsigned t, smp_submit_to_options options, Func &&func) noexcept
 
template<typename Func >
static futurize_t< std::invoke_result_t< Func > > submit_to (unsigned t, Func &&func) noexcept
 
static bool poll_queues ()
 
static bool pure_poll_queues ()
 
static std::ranges::range auto all_cpus () noexcept
 
template<typename Func >
requires std::is_nothrow_move_constructible_v<Func>
static future invoke_on_all (smp_submit_to_options options, Func &&func) noexcept
 
template<typename Func >
static future invoke_on_all (Func &&func) noexcept
 
template<typename Func >
requires std::is_nothrow_move_constructible_v<Func> && std::is_nothrow_copy_constructible_v<Func>
static future invoke_on_others (unsigned cpu_id, smp_submit_to_options options, Func func) noexcept
 
template<typename Func >
requires std::is_nothrow_move_constructible_v<Func>
static future invoke_on_others (unsigned cpu_id, Func func) noexcept
 
template<typename Func >
requires std::is_nothrow_move_constructible_v<Func>
static future invoke_on_others (Func func) noexcept
 

Static Public Attributes

static unsigned count
 

Member Function Documentation

◆ invoke_on_all() [1/2]

template<typename Func >
static future seastar::smp::invoke_on_all ( Func &&  func)
inlinestaticnoexcept

Invokes func on all shards.

Parameters
functhe function to be invoked on each shard. May return void or future<>. Each async invocation will work with a separate copy of func.
Returns
a future that resolves when all async invocations finish.

Passes the default smp_submit_to_options to the smp::submit_to() called behind the scenes.

◆ invoke_on_all() [2/2]

template<typename Func >
requires std::is_nothrow_move_constructible_v<Func>
static future seastar::smp::invoke_on_all ( smp_submit_to_options  options,
Func &&  func 
)
inlinestaticnoexcept

Invokes func on all shards.

Parameters
optionsthe options to forward to the smp::submit_to() called behind the scenes.
functhe function to be invoked on each shard. May return void or future<>. Each async invocation will work with a separate copy of func.
Returns
a future that resolves when all async invocations finish.

◆ invoke_on_others() [1/3]

template<typename Func >
requires std::is_nothrow_move_constructible_v<Func>
static future seastar::smp::invoke_on_others ( Func  func)
inlinestaticnoexcept

Invokes func on all shards but the current one

Parameters
functhe function to be invoked on each shard. May return void or future<>. Each async invocation will work with a separate copy of func.
Returns
a future that resolves when all async invocations finish.

◆ invoke_on_others() [2/3]

template<typename Func >
requires std::is_nothrow_move_constructible_v<Func>
static future seastar::smp::invoke_on_others ( unsigned  cpu_id,
Func  func 
)
inlinestaticnoexcept

Invokes func on all other shards.

Parameters
cpu_idthe cpu on which not to run the function.
functhe function to be invoked on each shard. May return void or future<>. Each async invocation will work with a separate copy of func.
Returns
a future that resolves when all async invocations finish.

Passes the default smp_submit_to_options to the smp::submit_to() called behind the scenes.

◆ invoke_on_others() [3/3]

template<typename Func >
requires std::is_nothrow_move_constructible_v<Func> && std::is_nothrow_copy_constructible_v<Func>
static future seastar::smp::invoke_on_others ( unsigned  cpu_id,
smp_submit_to_options  options,
Func  func 
)
inlinestaticnoexcept

Invokes func on all other shards.

Parameters
cpu_idthe cpu on which not to run the function.
optionsthe options to forward to the smp::submit_to() called behind the scenes.
functhe function to be invoked on each shard. May return void or future<>. Each async invocation will work with a separate copy of func.
Returns
a future that resolves when all async invocations finish.

◆ submit_to() [1/2]

template<typename Func >
static futurize_t< std::invoke_result_t< Func > > seastar::smp::submit_to ( unsigned  t,
Func &&  func 
)
inlinestaticnoexcept

Runs a function on a remote core.

Uses default_smp_service_group() to control resource allocation.

Parameters
tdesignates the core to run the function on (may be a remote core or the local core).
funca callable to run on core t. If func is a temporary object, its lifetime will be extended by moving. This movement and the eventual destruction of func are both done in the calling core. If func is a reference, the caller must guarantee that it will survive the call.
Returns
whatever func returns, as a future<> (if func does not return a future, submit_to() will wrap it in a future<>).

◆ submit_to() [2/2]

template<typename Func >
static futurize_t< std::invoke_result_t< Func > > seastar::smp::submit_to ( unsigned  t,
smp_submit_to_options  options,
Func &&  func 
)
inlinestaticnoexcept

Runs a function on a remote core.

Parameters
tdesignates the core to run the function on (may be a remote core or the local core).
optionsan smp_submit_to_options that contains options for this call.
funca callable to run on core t. If func is a temporary object, its lifetime will be extended by moving. This movement and the eventual destruction of func are both done in the calling core. If func is a reference, the caller must guarantee that it will survive the call.
Returns
whatever func returns, as a future<> (if func does not return a future, submit_to() will wrap it in a future<>).

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