Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Do not take NULL to mean 'the current address space' in dwarf expressions
[simgrid.git] / src / mc / mc_base.c
index 20d8f43..e3717ef 100644 (file)
@@ -92,6 +92,23 @@ int MC_request_is_enabled(smx_simcall_t req)
     }
     return FALSE;
 
+  case SIMCALL_MUTEX_LOCK: {
+    smx_mutex_t mutex = simcall_mutex_lock__get__mutex(req);
+#ifdef HAVE_MC
+    s_smx_mutex_t temp_mutex;
+    if (!MC_process_is_self(&mc_model_checker->process)) {
+      MC_process_read(&mc_model_checker->process, MC_PROCESS_NO_FLAG,
+        &temp_mutex, mutex, sizeof(temp_mutex),
+        MC_PROCESS_INDEX_ANY);
+      mutex = &temp_mutex;
+    }
+#endif
+    if(mutex->owner == NULL)
+      return TRUE;
+    else
+      return (mutex->owner->pid == req->issuer->pid);
+    }
+
   default:
     /* The rest of the requests are always enabled */
     return TRUE;
@@ -107,6 +124,7 @@ int MC_request_is_visible(smx_simcall_t req)
       || req->call == SIMCALL_COMM_TEST
       || req->call == SIMCALL_COMM_TESTANY
       || req->call == SIMCALL_MC_RANDOM
+      || req->call == SIMCALL_MUTEX_LOCK
 #ifdef HAVE_MC
       || req->call == SIMCALL_MC_SNAPSHOT
       || req->call == SIMCALL_MC_COMPARE_SNAPSHOTS