X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gold%2Fworkqueue-threads.cc;h=0acb4d5c9aa07d707de7b1bfe914f34983f5e3cf;hb=db3ad2f031d4da70db35977abbcede0399d81d6b;hp=60d4adcbb3a579b4d74628686d6b63cd42c7b5d1;hpb=ebdbb4583d9b05504b1ca7e4f6c370f5d355e9bd;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/workqueue-threads.cc b/gold/workqueue-threads.cc index 60d4adcbb3..0acb4d5c9a 100644 --- a/gold/workqueue-threads.cc +++ b/gold/workqueue-threads.cc @@ -1,6 +1,6 @@ // workqueue-threads.cc -- the threaded workqueue for gold -// Copyright 2007, 2008 Free Software Foundation, Inc. +// Copyright (C) 2007-2019 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -174,7 +174,7 @@ Workqueue_threader_threadpool::set_thread_count(int thread_count) // Return whether the current thread should be cancelled. bool -Workqueue_threader_threadpool::should_cancel_thread() +Workqueue_threader_threadpool::should_cancel_thread(int thread_number) { // Fast exit without taking a lock. if (!this->check_thread_count_) @@ -182,12 +182,13 @@ Workqueue_threader_threadpool::should_cancel_thread() { Hold_lock hl(this->lock_); - if (this->threads_ > this->desired_thread_count_) + if (thread_number > this->desired_thread_count_) { --this->threads_; + if (this->threads_ <= this->desired_thread_count_) + this->check_thread_count_ = 0; return true; } - this->check_thread_count_ = 0; } return false;