Seastar
High performance C++ framework for concurrent servers
Classes | Functions
seastar::alien Namespace Reference

Detailed Description

Integration with non-seastar applications.

Classes

class  message_queue
 
class  instance
 

Functions

template<typename Func >
void run_on (instance &instance, unsigned shard, Func func)
 
template<typename Func >
void run_on (unsigned shard, Func func)
 
template<typename Func , typename T = internal::return_type_t<Func>>
std::future< T > submit_to (instance &instance, unsigned shard, Func func)
 
template<typename Func , typename T = internal::return_type_t<Func>>
std::future< T > submit_to (unsigned shard, Func func)
 

Function Documentation

◆ run_on() [1/2]

template<typename Func >
void seastar::alien::run_on ( instance instance,
unsigned  shard,
Func  func 
)

Runs a function on a remote shard from an alien thread where engine() is not available.

Parameters
instancedesignates the Seastar instance to process the message
sharddesignates the shard to run the function on
funca callable to run on shard t. If func is a temporary object, its lifetime will be extended by moving it. If func is a reference, the caller must guarantee that it will survive the call.
Note
the func must not throw and should return void. as we cannot identify the alien thread, hence we are not able to post the fulfilled promise to the message queue managed by the shard executing the alien thread which is interested to the return value. Please use submit_to() instead, if func throws.

◆ run_on() [2/2]

template<typename Func >
void seastar::alien::run_on ( unsigned  shard,
Func  func 
)

Runs a function on a remote shard from an alien thread where engine() is not available.

Parameters
sharddesignates the shard to run the function on
funca callable to run on shard t. If func is a temporary object, its lifetime will be extended by moving it. If func is a reference, the caller must guarantee that it will survive the call.
Note
the func must not throw and should return void. as we cannot identify the alien thread, hence we are not able to post the fulfilled promise to the message queue managed by the shard executing the alien thread which is interested to the return value. Please use submit_to() instead, if func throws.

◆ submit_to() [1/2]

template<typename Func , typename T = internal::return_type_t<Func>>
std::future<T> seastar::alien::submit_to ( instance instance,
unsigned  shard,
Func  func 
)

Runs a function on a remote shard from an alien thread where engine() is not available.

Parameters
instancedesignates the Seastar instance to process the message
sharddesignates the shard to run the function on
funca callable to run on shard. If func is a temporary object, its lifetime will be extended by moving it. If func is a reference, the caller must guarantee that it will survive the call.
Returns
whatever func returns, as a std::future<>
Note
the caller must keep the returned future alive until func returns

◆ submit_to() [2/2]

template<typename Func , typename T = internal::return_type_t<Func>>
std::future<T> seastar::alien::submit_to ( unsigned  shard,
Func  func 
)

Runs a function on a remote shard from an alien thread where engine() is not available.

Parameters
sharddesignates the shard to run the function on
funca callable to run on shard. If func is a temporary object, its lifetime will be extended by moving it. If func is a reference, the caller must guarantee that it will survive the call.
Returns
whatever func returns, as a std::future<>
Note
the caller must keep the returned future alive until func returns