X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/65e32be46137f88aaa89385c2c9e83025bfbb06f..f06f53287a228a869aba211842c5e46ab29b116a:/src/s4u/s4u_Actor.cpp diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 33d319a022..5732d13a6a 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -86,12 +86,23 @@ int Actor::get_refcount() void Actor::join() { - simcall_process_join(this->pimpl_, -1); + join(-1); } void Actor::join(double timeout) { - simcall_process_join(this->pimpl_, timeout); + auto issuer = SIMIX_process_self(); + auto target = pimpl_; + simix::simcall_blocking([issuer, target, timeout] { + if (target->finished_) { + // The joined process is already finished, just wake up the issuer right away + issuer->simcall_answer(); + } else { + smx_activity_t sync = issuer->join(target, timeout); + sync->simcalls_.push_back(&issuer->simcall); + issuer->waiting_synchro = sync; + } + }); } void Actor::set_auto_restart(bool autorestart)