Ferenc Szontágh
2024-06-27 0c428a79ef2379c6c7be29712e83f8c39e43c580
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
39
40
#ifndef SERVER_H
#define SERVER_H
 
#include <vector>
#include <thread>
#include <memory>
#include <dlfcn.h>
#include <atomic>
#include <glog/logging.h>
#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::thread> threadPool;  // Use std::thread directly
    std::vector<void*> pluginHandles;
    std::vector<std::shared_ptr<IPlugin>> plugins;
    std::unique_ptr<IPC> ipc;
    Config config;
    std::atomic<bool> reloadConfigFlag;
 
    static Server* instance;
};
 
#endif // SERVER_H