Make event loops able to be run in another thread

This commit is contained in:
KimLS
2019-03-29 18:39:17 -07:00
parent 566f743a88
commit 21a39db1c6
16 changed files with 82 additions and 29 deletions
+4 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include "tcp_connection.h"
#include "../event/event_loop.h"
namespace EQ
{
@@ -10,6 +11,7 @@ namespace EQ
{
public:
TCPServer();
TCPServer(EQ::EventLoop *loop);
~TCPServer();
void Listen(int port, bool ipv6, std::function<void(std::shared_ptr<TCPConnection>)> cb);
@@ -19,7 +21,8 @@ namespace EQ
private:
std::function<void(std::shared_ptr<TCPConnection>)> m_on_new_connection;
EQ::EventLoop *m_loop;
uv_tcp_t *m_socket;
};
}
}
}