Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
further cleanups of the MC protocol (and fix its build :)
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 16 Jul 2017 16:22:42 +0000 (18:22 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 16 Jul 2017 16:24:38 +0000 (18:24 +0200)
src/mc/ModelChecker.cpp
src/mc/ModelChecker.hpp
src/mc/Session.cpp
src/mc/mc_unw.h
src/mc/remote/Client.cpp
src/mc/remote/Client.hpp

index 339d637..855c0a7 100644 (file)
@@ -387,9 +387,9 @@ void ModelChecker::on_signal(int signo)
   }
 }
 
-void ModelChecker::wait_client(simgrid::mc::RemoteClient& process)
+void ModelChecker::wait_for_requests()
 {
-  this->resume(process);
+  this->resume(process());
   if (this->process().running())
     event_base_dispatch(base_);
 }
index 9554345..bb733e3 100644 (file)
@@ -69,12 +69,8 @@ public:
   void resume(simgrid::mc::RemoteClient& process);
   void loop();
   void handle_events(int fd, short events);
-  void wait_client(simgrid::mc::RemoteClient& process);
+  void wait_for_requests();
   void handle_simcall(Transition const& transition);
-  void wait_for_requests()
-  {
-    mc_model_checker->wait_client(mc_model_checker->process());
-  }
   void exit(int status);
 
   bool checkDeadlock();
index 84a2105..566858b 100644 (file)
@@ -136,7 +136,7 @@ void Session::logState()
 Session* Session::fork(std::function<void()> code)
 {
   // Create a AF_LOCAL socketpair used for exchanging messages
-  // bewteen the model-checker process (ourselves) and the model-checked
+  // between the model-checker process (ourselves) and the model-checked
   // process:
   int res;
   int sockets[2];
index 8227402..6a6b861 100644 (file)
  */
 
 #include "src/mc/mc_forward.hpp"
+#include "xbt/base.h"
 
 #include <libunwind.h>
+#include <stdio.h>
 #include <sys/types.h>
 
 namespace simgrid {
index 2962c8f..8eaa9f9 100644 (file)
@@ -33,7 +33,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client, mc, "MC client logic");
 namespace simgrid {
 namespace mc {
 
-std::unique_ptr<Client> Client::client_;
+std::unique_ptr<Client> Client::instance_;
 
 Client* Client::initialize()
 {
@@ -43,8 +43,8 @@ Client* Client::initialize()
     return nullptr;
 
   // Do not break if we are called multiple times:
-  if (client_)
-    return client_.get();
+  if (instance_)
+    return instance_.get();
 
   _sg_do_model_check = 1;
 
@@ -65,7 +65,7 @@ Client* Client::initialize()
     xbt_die("Unexpected socket type %i", type);
   XBT_DEBUG("Model-checked application found expected socket type");
 
-  client_ = std::unique_ptr<Client>(new simgrid::mc::Client(fd));
+  instance_ = std::unique_ptr<Client>(new simgrid::mc::Client(fd));
 
   // Wait for the model-checker:
   errno = 0;
@@ -79,8 +79,8 @@ Client* Client::initialize()
   if (errno != 0 || raise(SIGSTOP) != 0)
     xbt_die("Could not wait for the model-checker");
 
-  client_->handleMessages();
-  return client_.get();
+  instance_->handleMessages();
+  return instance_.get();
 }
 
 void Client::handleDeadlockCheck(mc_message_t* msg)
index 149140e..b9059a3 100644 (file)
@@ -30,7 +30,7 @@ class XBT_PUBLIC() Client {
 private:
   bool active_ = false;
   Channel channel_;
-  static std::unique_ptr<Client> client_;
+  static std::unique_ptr<Client> instance_;
 
 public:
   Client();
@@ -59,7 +59,7 @@ public:
   // Singleton :/
   // TODO, remove the singleton antipattern.
   static Client* initialize();
-  static Client* get() { return client_.get(); }
+  static Client* get() { return instance_.get(); }
 };
 }
 }