비트 딱 맞는지 리눅스에서도 확인할 것
This commit is contained in:
@@ -2,16 +2,16 @@
|
||||
|
||||
namespace Chattr {
|
||||
|
||||
Session::Session() {
|
||||
init();
|
||||
Session::Session(Chattr::TCPSocket __sock) {
|
||||
init(std::move(__sock));
|
||||
}
|
||||
|
||||
Session::~Session() {
|
||||
destruct();
|
||||
}
|
||||
|
||||
bool Session::init() {
|
||||
return false;
|
||||
void Session::init(Chattr::TCPSocket __sock) {
|
||||
|
||||
}
|
||||
|
||||
void Session::destruct() {
|
||||
|
||||
27
impl/Socket/IOCP.cpp
Normal file
27
impl/Socket/IOCP.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "Socket/IOCP.hpp"
|
||||
#include "Socket/WSAManager.hpp"
|
||||
#include "Socket/Log.hpp"
|
||||
#include "precomp.hpp"
|
||||
|
||||
namespace Chattr {
|
||||
|
||||
IOCP::IOCP(std::shared_ptr<ThreadPool> __IOCPThread) {
|
||||
init(__IOCPThread);
|
||||
}
|
||||
|
||||
IOCP::~IOCP() {
|
||||
}
|
||||
|
||||
void IOCP::init(std::shared_ptr<ThreadPool> __IOCPThread) {
|
||||
IOCPThread_ = __IOCPThread;
|
||||
#ifdef _WIN32
|
||||
struct Chattr::WSAManager wsaManager;
|
||||
completinPort_ = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
|
||||
if (completinPort_ == NULL)
|
||||
log::critical("CreateIoCompletionPort()");
|
||||
#elif __linux__
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,22 @@
|
||||
|
||||
namespace Chattr {
|
||||
|
||||
ThreadPool::ThreadPool() {
|
||||
}
|
||||
|
||||
ThreadPool::ThreadPool(std::uint32_t numThreads) {
|
||||
init(numThreads);
|
||||
}
|
||||
|
||||
ThreadPool::~ThreadPool() {
|
||||
terminate_ = true;
|
||||
jobQueueCV_.notify_all();
|
||||
|
||||
for (auto& t : workers_)
|
||||
t.join();
|
||||
}
|
||||
|
||||
void ThreadPool::init(std::uint32_t numThreads) {
|
||||
int numCPU = numThreads;
|
||||
if (numThreads == 0) {
|
||||
#ifdef _WIN32
|
||||
@@ -22,14 +37,6 @@ ThreadPool::ThreadPool(std::uint32_t numThreads) {
|
||||
workers_.push_back([this]() { this->Worker(); });
|
||||
}
|
||||
|
||||
ThreadPool::~ThreadPool() {
|
||||
terminate_ = true;
|
||||
jobQueueCV_.notify_all();
|
||||
|
||||
for (auto& t : workers_)
|
||||
t.join();
|
||||
}
|
||||
|
||||
void* ThreadPool::Worker() {
|
||||
#ifdef _WIN32
|
||||
DWORD pid = GetCurrentThreadId();
|
||||
|
||||
Reference in New Issue
Block a user