-/* Copyright (c) 2016-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2016-2020. 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. */
try {
auto future = code();
future.then_([&result, self](std::shared_ptr<simgrid::kernel::FutureState<T>>&& value) {
- simgrid::xbt::set_promise(result, simgrid::kernel::Future<T>(value));
+ simgrid::xbt::set_promise(result, simgrid::kernel::Future<T>(std::move(value)));
simgrid::simix::unblock(self);
});
} catch (...) {
// When the kernel future is ready...
this->future_.then_([&result, self](std::shared_ptr<simgrid::kernel::FutureState<T>>&& value) {
// ... wake up the process with the result of the kernel future.
- simgrid::xbt::set_promise(result, simgrid::kernel::Future<T>(value));
+ simgrid::xbt::set_promise(result, simgrid::kernel::Future<T>(std::move(value)));
simgrid::simix::unblock(self);
});
} catch (...) {
// When the kernel future is ready...
this->future_.then_([this, self](std::shared_ptr<simgrid::kernel::FutureState<T>>&& value) {
// ...store it the simix kernel and wake up.
- this->future_ = std::move(simgrid::kernel::Future<T>(value));
+ this->future_ = simgrid::kernel::Future<T>(std::move(value));
simgrid::simix::unblock(self);
});
} catch (...) {
},
nullptr);
}
+
private:
// We wrap an event-based kernel future:
simgrid::kernel::Future<T> future_;