From aae6bdf486c3939fd15203a364c523ce91dad90b Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 11 Aug 2015 19:10:04 +0200 Subject: [PATCH 1/1] Fail loudly when someone tries to unlock a mutex owned by someone else This fixes #19500 on gforge. --- src/simix/smx_synchro.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/simix/smx_synchro.c b/src/simix/smx_synchro.c index 20d7b7fb52..59ea411d37 100644 --- a/src/simix/smx_synchro.c +++ b/src/simix/smx_synchro.c @@ -210,11 +210,10 @@ void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer) XBT_IN("(%p, %p)",mutex,issuer); smx_process_t p; /*process to wake up */ - /* If the mutex is not owned by the issuer do nothing */ - if (issuer != mutex->owner){ - XBT_OUT(); - return; - } + /* If the mutex is not owned by the issuer, that's not good */ + if (issuer != mutex->owner) + THROWF(mismatch_error, 0, "Cannot release that mutex: it was locked by %s (pid:%d), not by you.", + SIMIX_process_get_name(mutex->owner),SIMIX_process_get_PID(mutex->owner)); if (xbt_swag_size(mutex->sleeping) > 0) { p = xbt_swag_extract(mutex->sleeping); -- 2.20.1