- m.pid = pid;
- m.value = value;
- process.getChannel().send(m);
- process.clear_cache();
- while (process.running())
- if (!this->handle_events())
- return;
+ m.pid = transition.pid;
+ m.value = transition.argument;
+ this->process_->getChannel().send(m);
+ this->process_->clear_cache();
+ if (this->process_->running())
+ event_base_dispatch(base_);
+}
+
+bool ModelChecker::checkDeadlock()
+{
+ int res;
+ if ((res = this->process().getChannel().send(MC_MESSAGE_DEADLOCK_CHECK)))
+ xbt_die("Could not check deadlock state");
+ s_mc_message_int_t message;
+ ssize_t s = mc_model_checker->process().getChannel().receive(message);
+ if (s == -1)
+ xbt_die("Could not receive message");
+ if (s != sizeof(message) || message.type != MC_MESSAGE_DEADLOCK_CHECK_REPLY)
+ xbt_die("Received unexpected message %s (%i, size=%i) "
+ "expected MC_MESSAGE_DEADLOCK_CHECK_REPLY (%i, size=%i)",
+ MC_message_type_name(message.type), (int) message.type, (int) s,
+ (int) MC_MESSAGE_DEADLOCK_CHECK_REPLY, (int) sizeof(message)
+ );
+ return message.value != 0;