Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Handle simcall result through mc::SimcallObserver.
[simgrid.git] / src / mc / Session.cpp
index 3bd3c48..fe6b08a 100644 (file)
@@ -86,7 +86,7 @@ Session::Session(const std::function<void()>& code)
 
   xbt_assert(mc_model_checker == nullptr, "Did you manage to start the MC twice in this process?");
 
-  auto process = std::make_unique<simgrid::mc::RemoteSimulation>(pid);
+  auto process   = std::make_unique<simgrid::mc::RemoteProcess>(pid);
   model_checker_ = std::make_unique<simgrid::mc::ModelChecker>(std::move(process), sockets[1]);
 
   mc_model_checker = model_checker_.get();
@@ -98,8 +98,8 @@ Session::~Session()
   this->close();
 }
 
-/** Take the initial snapshot of the application, that must be stopped. */
-void Session::initialize()
+/** The application must be stopped. */
+void Session::take_initial_snapshot()
 {
   xbt_assert(initial_snapshot_ == nullptr);
   model_checker_->wait_for_requests();
@@ -114,7 +114,7 @@ void Session::execute(Transition const& transition) const
 
 void Session::restore_initial_state() const
 {
-  this->initial_snapshot_->restore(&model_checker_->get_remote_simulation());
+  this->initial_snapshot_->restore(&model_checker_->get_remote_process());
 }
 
 void Session::log_state() const
@@ -144,7 +144,9 @@ void Session::close()
 
 bool Session::actor_is_enabled(aid_t pid) const
 {
-  s_mc_message_actor_enabled_t msg{simgrid::mc::MessageType::ACTOR_ENABLED, pid};
+  s_mc_message_actor_enabled_t msg{};
+  msg.type = simgrid::mc::MessageType::ACTOR_ENABLED;
+  msg.aid  = pid;
   model_checker_->channel().send(msg);
   std::array<char, MC_MESSAGE_LENGTH> buff;
   ssize_t received = model_checker_->channel().receive(buff.data(), buff.size(), true);
@@ -152,7 +154,6 @@ bool Session::actor_is_enabled(aid_t pid) const
   return ((s_mc_message_int_t*)buff.data())->value;
 }
 
-simgrid::mc::Session* session;
-
+simgrid::mc::Session* session_singleton;
 }
 }