X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e9401099487c0170193c87c12126cf719051a1c1..89df17fd2f872e224e49bbdeeba43ca76a5b7d71:/src/mc/mc_server.cpp diff --git a/src/mc/mc_server.cpp b/src/mc/mc_server.cpp index 92c0e2efaf..9ea15bd0ba 100644 --- a/src/mc/mc_server.cpp +++ b/src/mc/mc_server.cpp @@ -95,21 +95,21 @@ void s_mc_server::shutdown() XBT_DEBUG("Shuting down model-checker"); mc_process_t process = &mc_model_checker->process(); - int status = process->status; - if (process->running) { + int status = process->status(); + if (process->running()) { XBT_DEBUG("Killing process"); kill(process->pid(), SIGTERM); if (waitpid(process->pid(), &status, 0) == -1) throw std::system_error(errno, std::system_category()); // TODO, handle the case when the process does not want to die with a timeout - process->status = status; + process->terminate(status); } } void s_mc_server::exit() { // Finished: - int status = mc_model_checker->process().status; + int status = mc_model_checker->process().status(); if (WIFEXITED(status)) ::exit(WEXITSTATUS(status)); else if (WIFSIGNALED(status)) { @@ -272,7 +272,7 @@ bool s_mc_server::handle_events() void s_mc_server::loop() { - while (mc_model_checker->process().running) + while (mc_model_checker->process().running()) this->handle_events(); } @@ -305,7 +305,7 @@ void s_mc_server::handle_waitpid() if (pid == -1) { if (errno == ECHILD) { // No more children: - if (mc_model_checker->process().running) + if (mc_model_checker->process().running()) xbt_die("Inconsistent state"); else break; @@ -318,8 +318,7 @@ void s_mc_server::handle_waitpid() if (pid == mc_model_checker->process().pid()) { if (WIFEXITED(status) || WIFSIGNALED(status)) { XBT_DEBUG("Child process is over"); - mc_model_checker->process().status = status; - mc_model_checker->process().running = false; + mc_model_checker->process().terminate(status); } } } @@ -339,7 +338,7 @@ void s_mc_server::on_signal(const struct signalfd_siginfo* info) void MC_server_wait_client(mc_process_t process) { mc_server->resume(process); - while (mc_model_checker->process().running) { + while (mc_model_checker->process().running()) { if (!mc_server->handle_events()) return; } @@ -354,7 +353,7 @@ void MC_server_simcall_handle(mc_process_t process, unsigned long pid, int value m.value = value; MC_protocol_send(mc_model_checker->process().socket, &m, sizeof(m)); process->cache_flags = (mc_process_cache_flags_t) 0; - while (mc_model_checker->process().running) { + while (mc_model_checker->process().running()) { if (!mc_server->handle_events()) return; }