Ferenc Szontágh
2024-06-25 e5f77bce96abea49d65ff25e41c9ce2dae01c8dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef SERVER_H
#define SERVER_H
 
#include <vector>
#include <thread>
#include <memory>
#include <dlfcn.h>
#include <atomic>
#include "IPC.h"
#include "PluginInterface.h"
#include "Config.h"
 
class Server {
public:
    Server();
    ~Server();
    void run();
    void reloadConfig();
 
    static Server& getInstance();
 
private:
    void loadPlugins();
    void mainLoop();
    void handleIPC();
    static void handleSignal(int signal);
 
    std::vector<std::unique_ptr<std::thread>> threadPool;
    std::vector<void*> pluginHandles;
    std::vector<std::shared_ptr<IPlugin>> plugins;
    IPC ipc;
    Config config;
    std::atomic<bool> reloadConfigFlag;
 
    static Server* instance;
};
 
#endif // SERVER_H