SimGrid  3.21
Versatile Simulation of Distributed Systems
simgrid::simix Namespace Reference

Classes

class  Future
 A blocking (wait()-based) future for SIMIX processes. More...
 

Typedefs

typedef std::function< void()> ActorCode
 
typedef std::function< ActorCode(std::vector< std::string > args)> ActorCodeFactory
 

Functions

void unblock (smx_actor_t process)
 
template<class F >
auto kernel_sync (F code) -> decltype(code().get())
 Execute some code in kernel mode and wakes up the actor when the result is available. More...
 
template<class F >
auto kernelSync (F code) -> decltype(code().get())
 
template<class F >
auto kernel_async (F code) -> Future< decltype(code().get())>
 Start some asynchronous work. More...
 
template<class F >
auto kernelAsync (F code) -> Future< decltype(code().get())>
 
template<class F >
std::result_of< F()>::type simcall (F &&code)
 Execute some code in the kernel/maestro. More...
 
const std::vector< smx_actor_t > & process_get_runnable ()
 
void register_function (std::string name, ActorCodeFactory factory)
 

Typedef Documentation

◆ ActorCode

typedef std::function<void()> simgrid::simix::ActorCode

◆ ActorCodeFactory

typedef std::function<ActorCode(std::vector<std::string> args)> simgrid::simix::ActorCodeFactory

Function Documentation

◆ unblock()

void simgrid::simix::unblock ( smx_actor_t  process)

◆ kernel_sync()

template<class F >
auto simgrid::simix::kernel_sync ( code) -> decltype(code().get())

Execute some code in kernel mode and wakes up the actor when the result is available.

It is given a callback which is executed in the SimGrid kernel and returns a simgrid::kernel::Future<T>. The kernel blocks the actor until the Future is ready and:

  • either returns the value wrapped in the future to the actor;
  • or raises the exception stored in the future in the actor.

This can be used to implement blocking calls without adding new simcalls. One downside of this approach is that we don't have any semantic on what the actor is waiting. This might be a problem for the model-checker and we'll have to devise a way to make it work.

Parameters
codeKernel code returning a simgrid::kernel::Future<T>
Returns
Value of the kernel future
Exceptions
Exceptionfrom the kernel future

◆ kernelSync()

template<class F >
auto simgrid::simix::kernelSync ( code) -> decltype(code().get())

◆ kernel_async()

template<class F >
auto simgrid::simix::kernel_async ( code) -> Future<decltype(code().get())>

Start some asynchronous work.

Parameters
codeSimGrid kernel code which returns a simgrid::kernel::Future
Returns
Actor future

◆ kernelAsync()

template<class F >
auto simgrid::simix::kernelAsync ( code) -> Future<decltype(code().get())>

◆ simcall()

template<class F >
std::result_of<F()>::type simgrid::simix::simcall ( F &&  code)

Execute some code in the kernel/maestro.

This can be used to enforce mutual exclusion with other simcall. More importantly, this enforces a deterministic/reproducible ordering of the operation with respect to other simcalls.

◆ process_get_runnable()

const std::vector<smx_actor_t>& simgrid::simix::process_get_runnable ( )

◆ register_function()

void simgrid::simix::register_function ( std::string  name,
ActorCodeFactory  factory 
)