thread: 解决多线程读写竞争问题

ThreadPool::set() 中 new Thread(size()) 会初始化 bestvalue 和 lastvalue 的值,和
Thread::idle_loop() 中 bestvalue = lastvalue = VALUE_ZERO; 产生竞争。
故将后者删除。
This commit is contained in:
Calcitem 2020-10-24 12:15:13 +08:00
parent 9172c786d1
commit 63fe6d0d95
1 changed files with 1 additions and 1 deletions

View File

@ -114,7 +114,7 @@ void Thread::wait_for_search_finished()
void Thread::idle_loop()
{
bestvalue = lastvalue = VALUE_ZERO;
//bestvalue = lastvalue = VALUE_ZERO;
while (true) {
std::unique_lock<std::mutex> lk(mutex);