X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gold%2Fworkqueue-threads.cc;h=0acb4d5c9aa07d707de7b1bfe914f34983f5e3cf;hb=dc5626e83822493a2fb86dc029fc624952f66654;hp=ae09e29cf191b69a43cc54d8d01d699c78a66b7e;hpb=17a1d0a9b26ce8f4f71073c41483baa0c10ed83b;p=external%2Fbinutils.git diff --git a/gold/workqueue-threads.cc b/gold/workqueue-threads.cc index ae09e29..0acb4d5 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 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;