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)) {
void s_mc_server::loop()
{
- while (mc_model_checker->process().running)
+ while (mc_model_checker->process().running())
this->handle_events();
}
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;
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);
}
}
}
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;
}
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;
}