Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A blocking simcall does not make sense in kernel mode.
[simgrid.git] / include / simgrid / simix / blocking_simcall.hpp
index fd9797f..7a80fe5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2016-2021. 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. */
 
 #include <xbt/sysdep.h>
 
-#include <xbt/future.hpp>
 #include <simgrid/kernel/future.hpp>
 #include <simgrid/simix.h>
 #include <simgrid/simix.hpp>
+#include <xbt/promise.hpp>
 
 namespace simgrid {
 namespace simix {
@@ -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 {
@@ -70,11 +68,12 @@ template <class F> auto kernel_sync(F code) -> decltype(code().get())
 }
 
 /** A blocking (`wait()`-based) future for SIMIX processes */
-// TODO, .wait_for
-// TODO, .wait_until
-// TODO, SharedFuture
-// TODO, simgrid::simix::when_all - wait for all future to be ready (this one is simple!)
-// TODO, simgrid::simix::when_any - wait for any future to be ready
+// TODO:
+// - .wait_for
+// - .wait_until
+// - SharedFuture
+// - simgrid::simix::when_all - wait for all future to be ready (this one is simple!)
+// - simgrid::simix::when_any - wait for any future to be ready
 template <class T>
 class Future {
 public: