X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/84402e8e2ee2a2d0bef25fdceb0a263ed8b471f6..4b0fa756ae6e58a74c374a519389ecb9e8b6a4d9:/include/simgrid/simix/blocking_simcall.hpp diff --git a/include/simgrid/simix/blocking_simcall.hpp b/include/simgrid/simix/blocking_simcall.hpp index e43affe5e2..2bccf68dfb 100644 --- a/include/simgrid/simix/blocking_simcall.hpp +++ b/include/simgrid/simix/blocking_simcall.hpp @@ -56,8 +56,8 @@ template auto kernel_sync(F code) -> decltype(code().get()) [&result, self, &code] { try { auto future = code(); - future.then_([&result, self](std::shared_ptr>&& value) { - simgrid::xbt::set_promise(result, simgrid::kernel::Future(value)); + future.then_([&result, self](std::shared_ptr> value) { + simgrid::xbt::set_promise(result, simgrid::kernel::Future(std::move(value))); simgrid::simix::unblock(self); }); } catch (...) { @@ -80,6 +80,8 @@ class Future { public: Future() { /* Nothing to do*/} explicit Future(simgrid::kernel::Future future) : future_(std::move(future)) {} + Future(Future&&) noexcept = default; + Future& operator=(Future&&) noexcept = default; bool valid() const { return future_.valid(); } T get() @@ -92,9 +94,9 @@ public: [this, &result, self] { try { // When the kernel future is ready... - this->future_.then_([&result, self](std::shared_ptr>&& value) { + this->future_.then_([&result, self](std::shared_ptr> value) { // ... wake up the process with the result of the kernel future. - simgrid::xbt::set_promise(result, simgrid::kernel::Future(value)); + simgrid::xbt::set_promise(result, simgrid::kernel::Future(std::move(value))); simgrid::simix::unblock(self); }); } catch (...) { @@ -123,9 +125,9 @@ public: [this, &exception, self] { try { // When the kernel future is ready... - this->future_.then_([this, self](std::shared_ptr>&& value) { + this->future_.then_([this, self](std::shared_ptr> value) { // ...store it the simix kernel and wake up. - this->future_ = std::move(simgrid::kernel::Future(value)); + this->future_ = simgrid::kernel::Future(std::move(value)); simgrid::simix::unblock(self); }); } catch (...) { @@ -135,6 +137,7 @@ public: }, nullptr); } + private: // We wrap an event-based kernel future: simgrid::kernel::Future future_;