X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/018bdce8a96722fce641788226dd4bce6c03203c..1b238404f03d6ff882eff4267104225332fd8846:/doc/doxygen/uhood_switch.doc diff --git a/doc/doxygen/uhood_switch.doc b/doc/doxygen/uhood_switch.doc index 43fac9b403..7247341ac1 100644 --- a/doc/doxygen/uhood_switch.doc +++ b/doc/doxygen/uhood_switch.doc @@ -200,7 +200,7 @@ The crux of `future.then()` is: @code{cpp} template template -auto simgrid::kernel::Future::thenNoUnwrap(F continuation) +auto simgrid::kernel::Future::then_no_unwrap(F continuation) -> Future { typedef decltype(continuation(std::move(*this))) R; @@ -304,14 +304,14 @@ as input. It looks like this: # This looks like C++ but it is a basic IDL-like language # (one definition per line) parsed by a python script: -void process_kill(smx_process_t process); +void process_kill(smx_actor_t process); void process_killall(int reset_pid); -void process_cleanup(smx_process_t process) [[nohandler]]; -void process_suspend(smx_process_t process) [[block]]; -void process_resume(smx_process_t process); -void process_set_host(smx_process_t process, sg_host_t dest); -int process_is_suspended(smx_process_t process) [[nohandler]]; -int process_join(smx_process_t process, double timeout) [[block]]; +void process_cleanup(smx_actor_t process) [[nohandler]]; +void process_suspend(smx_actor_t process) [[block]]; +void process_resume(smx_actor_t process); +void process_set_host(smx_actor_t process, sg_host_t dest); +int process_is_suspended(smx_actor_t process) [[nohandler]]; +int process_join(smx_actor_t process, double timeout) [[block]]; int process_sleep(double duration) [[block]]; smx_mutex_t mutex_init(); @@ -330,7 +330,7 @@ struct s_smx_simcall { // Simcall number: e_smx_simcall_t call; // Issuing actor: - smx_process_t issuer; + smx_actor_t issuer; // Arguments of the simcall: union u_smx_scalar args[11]; // Result of the simcall: @@ -371,7 +371,7 @@ this generates a bunch of C++ files: responsible for wrapping the parameters in the `struct s_smx_simcall`; and wrapping out the result; -* [accessors](https://github.com/simgrid/simgrid/blob/4ae2fd01d8cc55bf83654e29f294335e3cb1f022/src/simix/popping_accessors.h) +* [accessors](https://github.com/simgrid/simgrid/blob/4ae2fd01d8cc55bf83654e29f294335e3cb1f022/src/simix/popping_accessors.hpp) to get/set values of of `struct s_smx_simcall`; * a simulation-kernel-side [big switch](https://github.com/simgrid/simgrid/blob/4ae2fd01d8cc55bf83654e29f294335e3cb1f022/src/simix/popping_generated.cpp#L106) @@ -468,20 +468,20 @@ kernel which will wake up the actor (with `simgrid::simix::unblock(actor)`) when the operation is completed. This is wrapped in a higher-level primitive as well. The -`kernelSync()` function expects a function-object which is executed +`kernel_sync()` function expects a function-object which is executed immediately in the simulation kernel and returns a `Future`. The simulator blocks the actor and resumes it when the `Future` becomes ready with its result: @code{cpp} template -auto kernelSync(F code) -> decltype(code().get()) +auto kernel_sync(F code) -> decltype(code().get()) { typedef decltype(code().get()) T; if (SIMIX_is_maestro()) xbt_die("Can't execute blocking call in kernel mode"); - smx_process_t self = SIMIX_process_self(); + smx_actor_t self = SIMIX_process_self(); simgrid::xbt::Result result; simcall_run_blocking([&result, self, &code]{ @@ -510,7 +510,7 @@ auto kernelSync(F code) -> decltype(code().get()) A contrived example of this would be: @code{cpp} -int res = simgrid::simix::kernelSync([&] { +int res = simgrid::simix::kernel_sync([&] { return kernel_wait_until(30).then( [](simgrid::kernel::Future future) { return 42; @@ -521,7 +521,7 @@ int res = simgrid::simix::kernelSync([&] { ### Asynchronous operations {#uhood_switch_v2_async} -We can write the related `kernelAsync()` which wakes up the actor immediately +We can write the related `kernel_async()` which wakes up the actor immediately and returns a future to the actor. As this future is used in the actor context, it is a different future (`simgrid::simix::Future` instead of `simgrid::kernel::Future`) @@ -551,7 +551,7 @@ T simgrid::simix::Future::get() { if (!valid()) throw std::future_error(std::future_errc::no_state); - smx_process_t self = SIMIX_process_self(); + smx_actor_t self = SIMIX_process_self(); simgrid::xbt::Result result; simcall_run_blocking([this, &result, self]{ try { @@ -572,12 +572,12 @@ T simgrid::simix::Future::get() } @endcode -`kernelAsync()` simply :wink: calls `kernelImmediate()` and wraps the +`kernel_async()` simply :wink: calls `kernelImmediate()` and wraps the `simgrid::kernel::Future` into a `simgrid::simix::Future`: @code{cpp} template -auto kernelAsync(F code) +auto kernel_async(F code) -> Future { typedef decltype(code().get()) T; @@ -594,7 +594,7 @@ auto kernelAsync(F code) A contrived example of this would be: @code{cpp} -simgrid::simix::Future future = simgrid::simix::kernelSync([&] { +simgrid::simix::Future future = simgrid::simix::kernel_sync([&] { return kernel_wait_until(30).then( [](simgrid::kernel::Future future) { return 42; @@ -605,18 +605,18 @@ do_some_stuff(); int res = future.get(); @endcode -`kernelSync()` could be rewritten as: +`kernel_sync()` could be rewritten as: @code{cpp} template -auto kernelSync(F code) -> decltype(code().get()) +auto kernel_sync(F code) -> decltype(code().get()) { - return kernelAsync(std::move(code)).get(); + return kernel_async(std::move(code)).get(); } @endcode The semantic is equivalent but this form would require two simcalls -instead of one to do the same job (one in `kernelAsync()` and one in +instead of one to do the same job (one in `kernel_async()` and one in `.get()`). ## Mutexes and condition variables @@ -629,7 +629,7 @@ which can be exposed using the same API as `std::condition_variable`: @code{cpp} class ConditionVariable { private: - friend s_smx_cond; + friend s_smx_cond_t; smx_cond_t cond_; ConditionVariable(smx_cond_t cond) : cond_(cond) {} public: @@ -769,7 +769,7 @@ We wrote two future implementations based on the `std::future` API: * the second one is a wait-based (`future.get()`) future used in the actors which waits using a simcall. -These futures are used to implement `kernelSync()` and `kernelAsync()` which +These futures are used to implement `kernel_sync()` and `kernel_async()` which expose asynchronous operations in the simulation kernel to the actors. In addition, we wrote variations of some other C++ standard library