Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge pull request #114 from adfaure/master
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 12 Sep 2016 20:41:13 +0000 (22:41 +0200)
committerGitHub <noreply@github.com>
Mon, 12 Sep 2016 20:41:13 +0000 (22:41 +0200)
fix segmentation fault when process try to unlock a not locked mutex

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)