21 lines
369 B
C++
21 lines
369 B
C++
|
#pragma once
|
||
|
#include "tcp_connection.hpp"
|
||
|
#include <thread>
|
||
|
#include <unordered_map>
|
||
|
|
||
|
|
||
|
namespace tinyrpc {
|
||
|
|
||
|
class IOThread {
|
||
|
public:
|
||
|
IOThread();
|
||
|
~IOThread();
|
||
|
bool addClient(int fd);
|
||
|
private:
|
||
|
void mainFunc();
|
||
|
private:
|
||
|
std::unordered_map<int, TcpConnection*> m_clients;
|
||
|
std::thread m_thread;
|
||
|
};
|
||
|
|
||
|
}
|