X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b25f2f8d84b6b239f9f32a77a91423648c5448a5..f06f53287a228a869aba211842c5e46ab29b116a:/src/s4u/s4u_Actor.cpp diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 438c476fe4..5732d13a6a 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -28,6 +28,7 @@ xbt::signal s4u::Actor::on_sleep; xbt::signal s4u::Actor::on_wake_up; xbt::signal s4u::Actor::on_migration_start; xbt::signal s4u::Actor::on_migration_end; +xbt::signal s4u::Actor::on_termination; xbt::signal s4u::Actor::on_destruction; // ***** Actor creation ***** @@ -76,17 +77,32 @@ void intrusive_ptr_release(Actor* actor) { intrusive_ptr_release(actor->pimpl_); } +int Actor::get_refcount() +{ + return pimpl_->get_refcount(); +} // ***** Actor methods ***** 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)