X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8c7c0f5d324ecb46f856e532350c1a463500c3a7..6ebb4fb025da8422b9fa57533ec966430b5fff6c:/src/kernel/activity/SemaphoreImpl.cpp diff --git a/src/kernel/activity/SemaphoreImpl.cpp b/src/kernel/activity/SemaphoreImpl.cpp index 03998f275b..61fd945666 100644 --- a/src/kernel/activity/SemaphoreImpl.cpp +++ b/src/kernel/activity/SemaphoreImpl.cpp @@ -8,7 +8,7 @@ #include "src/kernel/activity/SemaphoreImpl.hpp" #include "src/kernel/activity/Synchro.hpp" -#include "src/kernel/actor/SimcallObserver.hpp" +#include "src/kernel/actor/SynchroObserver.hpp" #include "src/kernel/resource/CpuImpl.hpp" #include // std::isfinite @@ -19,6 +19,8 @@ namespace simgrid { namespace kernel { namespace activity { +/* -------- Acquisition -------- */ + void SemAcquisitionImpl::wait_for(actor::ActorImpl* issuer, double timeout) { xbt_assert(std::isfinite(timeout), "timeout is not finite!"); @@ -57,7 +59,7 @@ void SemAcquisitionImpl::finish() cancel(); // Unregister the acquisition from the semaphore /* Return to the englobing simcall that the wait_for timeouted */ - auto* observer = dynamic_cast(get_issuer()->simcall_.observer_); + auto* observer = dynamic_cast(get_issuer()->simcall_.observer_); xbt_assert(observer != nullptr); observer->set_result(true); } @@ -79,6 +81,10 @@ void SemAcquisitionImpl::cancel() "Cannot find myself in the waiting queue that I have to leave"); semaphore_->ongoing_acquisitions_.erase(it); } + +/* -------- Semaphore -------- */ +unsigned SemaphoreImpl::next_id_ = 0; + SemAcquisitionImplPtr SemaphoreImpl::acquire_async(actor::ActorImpl* issuer) { auto res = SemAcquisitionImplPtr(new kernel::activity::SemAcquisitionImpl(issuer, this), true);