#ifndef MC_SERVER_H
#define MC_SERVER_H
+#include <poll.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <sys/signalfd.h>
+#include <sys/types.h>
+
#include <xbt/misc.h>
+
+#include "mc_process.h"
SG_BEGIN_DECL()
extern mc_server_t mc_server;
-/** Initialise MC server
- *
- * @param PID of the model-checked process
- * @param socket file descriptor for communication with the model-checked process
- * @return 0 on success
- */
-int MC_server_init(pid_t pid, int socket);
+XBT_INTERNAL void MC_server_wait_client(mc_process_t process);
+XBT_INTERNAL void MC_server_simcall_handle(mc_process_t process, unsigned long pid, int value);
-/** Execute the MC server
- *
- * @return Status code (can be used with `exit()`)
- */
-void MC_server_run(void);
+XBT_INTERNAL void MC_server_loop(mc_server_t server);
SG_END_DECL()
void exit();
void resume(mc_process_t process);
void loop();
- void handle_events();
+ bool handle_events();
protected:
void handle_signals();
void handle_waitpid();