}
}
-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_);
}
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();
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];
*/
#include "src/mc/mc_forward.hpp"
+#include "xbt/base.h"
#include <libunwind.h>
+#include <stdio.h>
#include <sys/types.h>
namespace simgrid {
namespace simgrid {
namespace mc {
-std::unique_ptr<Client> Client::client_;
+std::unique_ptr<Client> Client::instance_;
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;
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;
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)
private:
bool active_ = false;
Channel channel_;
- static std::unique_ptr<Client> client_;
+ static std::unique_ptr<Client> instance_;
public:
Client();
// Singleton :/
// TODO, remove the singleton antipattern.
static Client* initialize();
- static Client* get() { return client_.get(); }
+ static Client* get() { return instance_.get(); }
};
}
}