Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix segmentation fault when process try to unlock a not locked mutex
authoradfaure <adrien.faure2@gmail.com>
Mon, 12 Sep 2016 09:54:24 +0000 (11:54 +0200)
committeradfaure <adrien.faure2@gmail.com>
Mon, 12 Sep 2016 09:54:24 +0000 (11:54 +0200)
src/simix/smx_synchro.cpp

index 7825471..b1a6485 100644 (file)
@@ -163,6 +163,8 @@ bool Mutex::try_lock(smx_actor_t issuer)
 void Mutex::unlock(smx_actor_t issuer)
 {
   XBT_IN("(%p, %p)", this, issuer);
+  if(!this->locked)
+    THROWF(mismatch_error, 0, "Cannot release that mutex: it was not locked.");
 
   /* If the mutex is not owned by the issuer, that's not good */
   if (issuer != this->owner)