Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A blocking simcall does not make sense in kernel mode.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 15 Mar 2021 22:15:23 +0000 (23:15 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 15 Mar 2021 22:15:23 +0000 (23:15 +0100)
include/simgrid/simix.hpp
include/simgrid/simix/blocking_simcall.hpp

index 12f84f5..22e84df 100644 (file)
@@ -78,10 +78,7 @@ template <class F> typename std::result_of_t<F()> simcall(F&& code, mc::SimcallO
  */
 template <class R, class F> R simcall_blocking(F&& code, mc::SimcallObserver* t = nullptr)
 {
-  // If we are in the maestro, we take the fast path and execute the
-  // code directly without simcall marshalling/unmarshalling/dispatch:
-  if (SIMIX_is_maestro())
-    return std::forward<F>(code)();
+  xbt_assert(not SIMIX_is_maestro(), "Cannot execute blocking call in kernel mode");
 
   // If we are in the application, pass the code to the maestro which
   // executes it for us and reports the result. We use a std::future which
index 110a27d..7a80fe5 100644 (file)
@@ -46,12 +46,10 @@ XBT_PUBLIC void unblock(smx_actor_t process);
 template <class F> auto kernel_sync(F code) -> decltype(code().get())
 {
   using T = decltype(code().get());
-  if (SIMIX_is_maestro())
-    xbt_die("Can't execute blocking call in kernel mode");
+  xbt_assert(not SIMIX_is_maestro(), "Cannot execute blocking call in kernel mode");
 
   smx_actor_t self = SIMIX_process_self();
   simgrid::xbt::Result<T> result;
-
   simcall_run_blocking(
       [&result, self, &code] {
         try {