Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Remote support for filling state->internal_comm
[simgrid.git] / src / mc / mc_server.h
1 /* Copyright (c) 2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef MC_SERVER_H
8 #define MC_SERVER_H
9
10 #include <xbt/misc.h>
11
12 SG_BEGIN_DECL()
13
14 #define MC_SERVER_ERROR 127
15
16 typedef struct s_mc_server s_mc_server_t, *mc_server_t;
17
18 extern mc_server_t mc_server;
19
20 SG_END_DECL()
21
22 #ifdef __cplusplus
23
24 struct s_mc_server {
25 private:
26   pid_t pid;
27   int socket;
28   struct pollfd fds[2];
29 public:
30   s_mc_server(pid_t pid, int socket);
31   void start();
32   void shutdown();
33   void exit();
34   void resume(mc_process_t process);
35   void loop();
36   void handle_events();
37 protected:
38   void handle_signals();
39   void handle_waitpid();
40   void on_signal(const struct signalfd_siginfo* info);
41 };
42
43 #endif
44
45 #endif