Argentum Online - Servidor
th_dispatcher.h
1 #ifndef TH_DISPATCHER_H
2 #define TH_DISPATCHER_H
3 
4 #include <mutex>
5 #include <unordered_map>
6 
7 #include "../include/blocking_th_event_handler.h"
8 #include "../include/event.h"
9 #include "../include/event_handler.h"
10 
12  private:
13  std::mutex m;
14  std::unordered_map<int, EventHandler*> handlers;
15 
16  void apply_to_threaded(void (BlockingThEventHandler::*func)());
17 
18  void stop_handlers();
19  void join_handlers();
20 
21  protected:
22  void handle(Event& ev) override;
23 
24  public:
25  ThDispatcher();
26  ~ThDispatcher();
27 
28  void stop() override;
29 
30  void join() override;
31 };
32 
33 #endif // TH_DISPATCHER_H
Event
Definition: event.h:55
ThDispatcher
Definition: th_dispatcher.h:11
BlockingThEventHandler
Definition: blocking_th_event_handler.h:22
ThDispatcher::join
void join() override
Join the thread.
Definition: th_dispatcher.cpp:137