From: Gabriel Corona Date: Tue, 17 Nov 2015 10:02:31 +0000 (+0100) Subject: [mc] Move MC-related out of simix and into mc where it belongs X-Git-Tag: v3_13~1579 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/20c4a4134847860ac7093fa36623e47b35888558?hp=527402910c17223c4a723058d06bf4e4b186795c [mc] Move MC-related out of simix and into mc where it belongs --- diff --git a/src/mc/mc_client.cpp b/src/mc/mc_client.cpp index 9caade7396..12edc6bfa1 100644 --- a/src/mc/mc_client.cpp +++ b/src/mc/mc_client.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -31,6 +32,12 @@ mc_client_t mc_client; void MC_client_init(void) { + if (mc_mode != MC_MODE_NONE) + return; + if (!getenv(MC_ENV_SOCKET_FD)) + return; + mc_mode = MC_MODE_CLIENT; + if (mc_client) { XBT_WARN("MC_client_init called more than once."); return; @@ -54,6 +61,11 @@ void MC_client_init(void) mc_client = xbt_new0(s_mc_client_t, 1); mc_client->fd = fd; mc_client->active = 1; + + // Waiting for the model-checker: + if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) == -1 || raise(SIGSTOP) != 0) + xbt_die("Could not wait for the model-checker"); + MC_client_handle_messages(); } void MC_client_send_message(void* message, size_t size) diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index e1bf5ae9c4..0404d17deb 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -221,19 +221,7 @@ void SIMIX_global_init(int *argc, char **argv) #ifdef HAVE_MC // The communication initialization is done ASAP. // We need to communicate initialization of the different layers to the model-checker. - if (mc_mode == MC_MODE_NONE) { - if (getenv(MC_ENV_SOCKET_FD)) { - - mc_mode = MC_MODE_CLIENT; - MC_client_init(); - - // Waiting for the model-checker: - if (ptrace(PTRACE_TRACEME, 0, NULL, NULL) == -1 || raise(SIGSTOP) != 0) - xbt_die("Could not wait for the model-checker"); - - MC_client_handle_messages(); - } - } + MC_client_init(); #endif if (_sg_cfg_exit_asap)