Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use a custom Result<T> value for simgrid::smix::kernel()
[simgrid.git] / include / simgrid / simix.hpp
index c1b6a82..1f88d97 100644 (file)
@@ -41,16 +41,16 @@ typename std::result_of<F()>::type kernel(F&& code)
   if (SIMIX_is_maestro())
     return std::forward<F>(code)();
 
-  // If we are in the application, pass the code to the maestro which is
+  // 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
   // conveniently handles the success/failure value for us.
   typedef typename std::result_of<F()>::type R;
-  std::promise<R> promise;
+  simgrid::xbt::Result<R> result;
   simcall_run_kernel([&]{
     xbt_assert(SIMIX_is_maestro(), "Not in maestro");
-    simgrid::xbt::fulfillPromise(promise, std::forward<F>(code));
+    simgrid::xbt::fulfillPromise(result, std::forward<F>(code));
   });
-  return promise.get_future().get();
+  return result.get();
 }
 
 class Context;
@@ -136,7 +136,7 @@ public:
     : Context(std::move(code), cleanup_func, process)
   {}
 
-  ~AttachContext();
+  ~AttachContext() override;
 
   /** Called by the context when it is ready to give control
    *  to the maestro.