A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
model-checker : MUTEX_UNLOCK is invisible for MC
[simgrid.git]
/
src
/
mc
/
mc_base.c
diff --git
a/src/mc/mc_base.c
b/src/mc/mc_base.c
index
bd43d7a
..
2a58722
100644
(file)
--- a/
src/mc/mc_base.c
+++ b/
src/mc/mc_base.c
@@
-35,6
+35,7
@@
int MC_request_is_enabled(smx_simcall_t req)
{
unsigned int index = 0;
smx_synchro_t act = 0;
+ smx_mutex_t mutex = NULL;
switch (req->call) {
case SIMCALL_NONE:
@@
-63,6
+64,13
@@
int MC_request_is_enabled(smx_simcall_t req)
return TRUE;
return FALSE;
+ case SIMCALL_MUTEX_LOCK:
+ mutex = simcall_mutex_lock__get__mutex(req);
+ 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;
@@
-78,6
+86,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
@@
-101,7
+110,11
@@
static int prng_random(int min, int max)
// Use rejection in order to avoid skew
long x;
do {
+#ifndef _XBT_WIN32
x = random();
+#else
+ x = rand();
+#endif
} while( x >= accept_size );
return min + (x % output_size);
}