todo: iocp recv안되는 문제 해결하기
This commit is contained in:
@@ -19,7 +19,7 @@ void setDefaultLogger(spdlog::level::level_enum logLevel,
|
||||
sinks.push_back(std::make_shared<spdlog::sinks::msvc_sink_mt>());
|
||||
#endif
|
||||
auto chatteringLogger = std::make_shared<spdlog::logger>(
|
||||
"Chattering Logger", begin(sinks), end(sinks));
|
||||
"Logger", begin(sinks), end(sinks));
|
||||
chatteringLogger->set_level(logLevel);
|
||||
spdlog::set_default_logger(chatteringLogger);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#include "utils/thread_pool.h"
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
namespace utils {
|
||||
|
||||
ThreadPool::ThreadPool() : ThreadPool(0) {}
|
||||
|
||||
ThreadPool::ThreadPool(std::uint32_t numThreads) { init(numThreads); }
|
||||
ThreadPool::ThreadPool(std::uint32_t numThreads) { init_(numThreads); }
|
||||
|
||||
ThreadPool::~ThreadPool() { terminate(); }
|
||||
|
||||
void ThreadPool::init(std::uint32_t numThreads) {
|
||||
void ThreadPool::init_(std::uint32_t numThreads) {
|
||||
int numCPU = numThreads;
|
||||
if (numThreads == 0) {
|
||||
#ifdef _WIN32
|
||||
@@ -31,9 +30,9 @@ void ThreadPool::init(std::uint32_t numThreads) {
|
||||
}
|
||||
}
|
||||
threadCount = numCPU;
|
||||
workers_.reserve(numCPU);
|
||||
workers_.resize(numCPU);
|
||||
|
||||
while (numCPU--) workers_.emplace_back([this]() { this->Worker(); });
|
||||
while (numCPU--) workers_[numCPU] = std::thread([this]() { this->Worker(); });
|
||||
}
|
||||
|
||||
void ThreadPool::terminate() {
|
||||
@@ -47,7 +46,7 @@ void ThreadPool::terminate() {
|
||||
void ThreadPool::respawnWorker(std::uint32_t numThreads) {
|
||||
terminate();
|
||||
terminate_ = false;
|
||||
init(numThreads);
|
||||
init_(numThreads);
|
||||
}
|
||||
|
||||
void* ThreadPool::Worker() {
|
||||
@@ -79,4 +78,4 @@ void* ThreadPool::Worker() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace Chattr
|
||||
} // namespace utils
|
||||
|
||||
Reference in New Issue
Block a user