-/* 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 {
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 {
}
/** 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: