Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Read from remote process in MC_wait_for_requests()
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 16 Mar 2015 12:45:20 +0000 (13:45 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Mon, 16 Mar 2015 12:45:20 +0000 (13:45 +0100)
src/mc/mc_base.c

index 63d7a58..e3717ef 100644 (file)
@@ -41,7 +41,6 @@ int MC_request_is_enabled(smx_simcall_t req)
 #ifdef HAVE_MC
   s_smx_synchro_t temp_synchro;
 #endif
 #ifdef HAVE_MC
   s_smx_synchro_t temp_synchro;
 #endif
-  smx_mutex_t mutex = NULL;
 
   switch (req->call) {
   case SIMCALL_NONE:
 
   switch (req->call) {
   case SIMCALL_NONE:
@@ -93,12 +92,22 @@ int MC_request_is_enabled(smx_simcall_t req)
     }
     return FALSE;
 
     }
     return FALSE;
 
-  case SIMCALL_MUTEX_LOCK:
-    mutex = simcall_mutex_lock__get__mutex(req);
+  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);
     if(mutex->owner == NULL)
       return TRUE;
     else
       return (mutex->owner->pid == req->issuer->pid);
+    }
 
   default:
     /* The rest of the requests are always enabled */
 
   default:
     /* The rest of the requests are always enabled */