비트 딱 맞는지 리눅스에서도 확인할 것
This commit is contained in:
@@ -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