X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/970c8495eefefffaef85acdf1d6923799d95962a..ca82f90e6d610b6bb3b038cd9ee48d378cc8a909:/src/kernel/activity/MutexImpl.cpp diff --git a/src/kernel/activity/MutexImpl.cpp b/src/kernel/activity/MutexImpl.cpp index 7d528fa056..9274c47766 100644 --- a/src/kernel/activity/MutexImpl.cpp +++ b/src/kernel/activity/MutexImpl.cpp @@ -68,12 +68,11 @@ void MutexImpl::unlock(actor::ActorImpl* issuer) owner_->get_cname(), owner_->get_pid()); if (not sleeping_.empty()) { - /* pick one actor to wake up */ - actor::ActorImpl* act = &sleeping_.front(); + /* Give the ownership to the first waiting actor */ + owner_ = &sleeping_.front(); sleeping_.pop_front(); - act->waiting_synchro = nullptr; - owner_ = act; - act->simcall_answer(); + owner_->waiting_synchro = nullptr; + owner_->simcall_answer(); } else { /* nobody to wake up */ locked_ = false; @@ -102,15 +101,15 @@ void MutexImpl::unref() void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex) { - mutex->lock(simcall->issuer); + mutex->lock(simcall->issuer_); } int simcall_HANDLER_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex) { - return mutex->try_lock(simcall->issuer); + return mutex->try_lock(simcall->issuer_); } void simcall_HANDLER_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex) { - mutex->unlock(simcall->issuer); + mutex->unlock(simcall->issuer_); }