X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1067edf07adcaa046abb976e7d92174d608b2d91..63d238ad4d74226fae3321cb5c128f03160dacb2:/src/kernel/activity/ConditionVariableImpl.cpp diff --git a/src/kernel/activity/ConditionVariableImpl.cpp b/src/kernel/activity/ConditionVariableImpl.cpp index fdc23b405b..ec3fb6ae52 100644 --- a/src/kernel/activity/ConditionVariableImpl.cpp +++ b/src/kernel/activity/ConditionVariableImpl.cpp @@ -62,16 +62,14 @@ void ConditionVariableImpl::wait(MutexImpl* mutex, double timeout, actor::ActorI XBT_DEBUG("Wait condition %p", this); xbt_assert(std::isfinite(timeout), "timeout is not finite!"); - /* If there is a mutex unlock it */ - if (mutex != nullptr) { - auto* owner = mutex->get_owner(); - xbt_assert(owner == issuer, - "Actor %s cannot wait on ConditionVariable %p since it does not own the provided mutex %p (which is " - "owned by %s).", - issuer->get_cname(), this, mutex, (owner == nullptr ? "nobody" : owner->get_cname())); - mutex_ = mutex; - mutex->unlock(issuer); - } + /* Unlock the provided mutex (the simcall observer ensures that one is provided, no need to check) */ + auto* owner = mutex->get_owner(); + xbt_assert(owner == issuer, + "Actor %s cannot wait on ConditionVariable %p since it does not own the provided mutex %p (which is " + "owned by %s).", + issuer->get_cname(), this, mutex, (owner == nullptr ? "nobody" : owner->get_cname())); + mutex_ = mutex; + mutex->unlock(issuer); SynchroImplPtr synchro(new SynchroImpl([this, issuer]() { this->remove_sleeping_actor(*issuer);