X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1c178c9855b20b64211ebea92eb9f783b875bbe1..04cb8833befbe07b6b94ff0cae98bc17b78724e3:/include/simgrid/kernel/future.hpp diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index b3abf96765..777a9f48b2 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -48,7 +48,7 @@ public: FutureStateBase(FutureStateBase const&) = delete; FutureStateBase& operator=(FutureStateBase const&) = delete; - void schedule(simgrid::xbt::Task&& job); + XBT_PUBLIC(void) schedule(simgrid::xbt::Task&& job); void set_exception(std::exception_ptr exception) { @@ -61,7 +61,7 @@ public: void set_continuation(simgrid::xbt::Task&& continuation) { - xbt_assert(!continuation_); + xbt_assert(not continuation_); switch (status_) { case FutureStatus::done: // This is not supposed to happen if continuation is set @@ -121,6 +121,7 @@ protected: status_ = FutureStatus::done; if (exception_) { std::exception_ptr exception = std::move(exception_); + exception_ = nullptr; std::rethrow_exception(std::move(exception)); } } @@ -281,7 +282,7 @@ template class Future { public: Future() = default; - Future(std::shared_ptr> state): state_(std::move(state)) {} + Future(std::shared_ptr> state) : state_(std::move(state)) {} // Move type: Future(Future&) = delete; @@ -368,12 +369,9 @@ public: * the future is ready * @exception std::future_error no state is associated with the future */ - template - auto then(F continuation) - -> typename std::enable_if< - !is_future::value, - Future - >::type + template + auto then(F continuation) -> typename std::enable_if::value, + Future>::type { return this->thenNoUnwrap(std::move(continuation)); } @@ -390,8 +388,6 @@ public: } /** Get the value from the future - * - * This is expected to be called * * The future must be valid and ready in order to make this call. * @ref std::future blocks when the future is not ready but we are @@ -423,7 +419,7 @@ Future unwrapFuture(Future> future) return std::move(result); } -/** Producer side of a @simgrid::kernel::Future +/** Producer side of a @ref simgrid::kernel::Future * * A @ref Promise is connected to some `Future` and can be used to * set its result.