ChangeLog rotatation and copyright year update
[deliverable/binutils-gdb.git] / gold / workqueue-threads.cc
index 60d4adcbb3a579b4d74628686d6b63cd42c7b5d1..52931c04f03b102656c34187fa619c919a229917 100644 (file)
@@ -1,6 +1,6 @@
 // workqueue-threads.cc -- the threaded workqueue for gold
 
-// Copyright 2007, 2008 Free Software Foundation, Inc.
+// Copyright (C) 2007-2015 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // 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;
This page took 0.024788 seconds and 4 git commands to generate.