X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/88fad0aaff9eb463f048bfdfe4ad6218aba44ddb..bd681bde4c1fcad799c5c7c7ee5b58ad345157ef:/include/simgrid/simix/blocking_simcall.hpp?ds=sidebyside diff --git a/include/simgrid/simix/blocking_simcall.hpp b/include/simgrid/simix/blocking_simcall.hpp index ccfc8a1e5a..d99984abe9 100644 --- a/include/simgrid/simix/blocking_simcall.hpp +++ b/include/simgrid/simix/blocking_simcall.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2016-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2016-2018. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -33,7 +32,7 @@ XBT_PUBLIC void unblock(smx_actor_t process); * returns a `simgrid::kernel::Future`. The kernel blocks the actor * until the Future is ready and: * - * - either returns the value wrapped in the future to the actor; + * - either returns the value wrapped in the future to the actor * * - or raises the exception stored in the future in the actor. * @@ -46,8 +45,7 @@ XBT_PUBLIC void unblock(smx_actor_t process); * @return Value of the kernel future * @exception Exception from the kernel future */ -template -auto kernelSync(F code) -> decltype(code().get()) +template auto kernel_sync(F code) -> decltype(code().get()) { typedef decltype(code().get()) T; if (SIMIX_is_maestro()) @@ -60,7 +58,7 @@ auto kernelSync(F code) -> decltype(code().get()) try { auto future = code(); future.then_([&result, self](std::shared_ptr>&& value) { - simgrid::xbt::setPromise(result, simgrid::kernel::Future(value)); + simgrid::xbt::set_promise(result, simgrid::kernel::Future(value)); simgrid::simix::unblock(self); }); } @@ -71,6 +69,11 @@ auto kernelSync(F code) -> decltype(code().get()) }); return result.get(); } +template +XBT_ATTRIB_DEPRECATED_v323("Please use simix::kernel_sync()") auto kernelSync(F code) -> decltype(code().get()) +{ + return kernel_sync(code); +} /** A blocking (`wait()`-based) future for SIMIX processes */ // TODO, .wait_for() @@ -96,7 +99,7 @@ public: // When the kernel future is ready... this->future_.then_([&result, self](std::shared_ptr>&& value) { // ... wake up the process with the result of the kernel future. - simgrid::xbt::setPromise(result, simgrid::kernel::Future(value)); + simgrid::xbt::set_promise(result, simgrid::kernel::Future(value)); simgrid::simix::unblock(self); }); } @@ -146,20 +149,21 @@ private: * @param code SimGrid kernel code which returns a simgrid::kernel::Future * @return Actor future */ -template -auto kernelAsync(F code) - -> Future +template auto kernel_async(F code) -> Future { typedef decltype(code().get()) T; // Execute the code in the kernel and get the kernel future: - simgrid::kernel::Future future = - simgrid::simix::kernelImmediate(std::move(code)); + simgrid::kernel::Future future = simgrid::simix::simcall(std::move(code)); // Wrap the kernel future in a actor future: return simgrid::simix::Future(std::move(future)); } - +template +XBT_ATTRIB_DEPRECATED_v323("Please use simix::kernel_sync()") auto kernelAsync(F code) -> Future +{ + return kernel_async(code); +} } }