Argentum Online - Servidor
th_socket_receiver.h
1 #ifndef TH_SOCKET_RECEIVER
2 #define TH_SOCKET_RECEIVER
3 
4 #include <atomic>
5 #include <condition_variable>
6 #include <mutex>
7 
8 #include "../blocking_queue.h"
9 #include "../blocking_th_event_handler.h"
10 #include "../thread.h"
11 #include "../types.h"
12 #include "protocol.h"
13 #include "socket.h"
14 
15 class ThSocketReceiver : public Thread {
16  private:
17  std::atomic<bool> running;
18  ClientId client_id;
19  Protocol protocol;
20  BlockingThEventHandler& recieve_handler;
21 
22  public:
23  ThSocketReceiver(int id, Socket& socket,
24  BlockingThEventHandler& recieve_handler);
25 
27  ThSocketReceiver& operator=(ThSocketReceiver&& other) = delete;
28 
29  virtual void run() override;
30 
31  void stop();
32 };
33 
34 #endif // TH_SOCKET_RECEIVER
Socket
Definition: socket.h:12
Protocol
Definition: protocol.h:12
BlockingThEventHandler
Definition: blocking_th_event_handler.h:22
ThSocketReceiver
Definition: th_socket_receiver.h:15
ThSocketReceiver::run
virtual void run() override
Function to be called by the thread.
Definition: th_socket_receiver.cpp:22
Thread
Definition: thread.h:9