From: Gabriel Corona Date: Mon, 20 Jun 2016 14:01:34 +0000 (+0200) Subject: [simix] Future::wait(), avoid simcall when we are ready X-Git-Tag: v3_14~931^2~2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4d91fd9b32ef1b98394c922e8d8198e2485ba024 [simix] Future::wait(), avoid simcall when we are ready --- diff --git a/include/simgrid/simix/blocking_simcall.hpp b/include/simgrid/simix/blocking_simcall.hpp index 2e26f0a2ba..f7f233c046 100644 --- a/include/simgrid/simix/blocking_simcall.hpp +++ b/include/simgrid/simix/blocking_simcall.hpp @@ -113,8 +113,10 @@ public: } void wait() { - if (!valid()) - throw std::future_error(std::future_errc::no_state); + // The future is ready! We don't have to wait: + if (this->is_ready()) + return; + // The future is not ready. We have to delegate to the SimGrid kernel: std::exception_ptr exception; smx_process_t self = SIMIX_process_self(); simcall_run_blocking([this, &exception, self]{