From 63fe6d0d956c8b2d7d0bc530f5d7e22d21f2c01f Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sat, 24 Oct 2020 12:15:13 +0800 Subject: [PATCH] =?UTF-8?q?thread:=20=E8=A7=A3=E5=86=B3=E5=A4=9A=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E8=AF=BB=E5=86=99=E7=AB=9E=E4=BA=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ThreadPool::set() 中 new Thread(size()) 会初始化 bestvalue 和 lastvalue 的值,和 Thread::idle_loop() 中 bestvalue = lastvalue = VALUE_ZERO; 产生竞争。 故将后者删除。 --- src/thread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thread.cpp b/src/thread.cpp index eeb191ed..72531159 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -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 lk(mutex);