일단 iocp는 완성한 듯 윈도우에서만 되면 될 듯
This commit is contained in:
@@ -63,11 +63,16 @@ void* ThreadPool::Worker() {
|
||||
#elif __linux__
|
||||
pthread_t pid = pthread_self();
|
||||
#endif
|
||||
spdlog::debug("ThreadPool Worker : {} up", pid);
|
||||
while (!terminate_) {
|
||||
std::unique_lock<std::mutex> lock(jobQueueMutex);
|
||||
jobQueueCV_.wait(lock, [this]() { return !this->jobs_.empty() || terminate_; });
|
||||
if (this->jobs_.empty())
|
||||
if (this->jobs_.empty() || terminate_) {
|
||||
jobs_ = std::queue<std::packaged_task<void()>>();
|
||||
break;
|
||||
}
|
||||
if (this->jobs_.empty())
|
||||
continue;
|
||||
|
||||
auto job = std::move(jobs_.front());
|
||||
jobs_.pop();
|
||||
@@ -76,6 +81,7 @@ void* ThreadPool::Worker() {
|
||||
spdlog::debug("ThreadPool Worker : {} Executing a job", pid);
|
||||
job();
|
||||
}
|
||||
spdlog::debug("ThreadPool Worker : {} down", pid);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user