thread: 解决多线程读写竞争问题
ThreadPool::set() 中 new Thread(size()) 会初始化 bestvalue 和 lastvalue 的值,和 Thread::idle_loop() 中 bestvalue = lastvalue = VALUE_ZERO; 产生竞争。 故将后者删除。
This commit is contained in:
parent
9172c786d1
commit
63fe6d0d95
|
@ -114,7 +114,7 @@ void Thread::wait_for_search_finished()
|
||||||
|
|
||||||
void Thread::idle_loop()
|
void Thread::idle_loop()
|
||||||
{
|
{
|
||||||
bestvalue = lastvalue = VALUE_ZERO;
|
//bestvalue = lastvalue = VALUE_ZERO;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
std::unique_lock<std::mutex> lk(mutex);
|
std::unique_lock<std::mutex> lk(mutex);
|
||||||
|
|
Loading…
Reference in New Issue