Add thread_number parameter.
(Workqueue_threader_threadpool::should_cancel_thread): Likewise.
* workqueue-threads.cc
(Workqueue_threader_threadpool::should_cancel_thread): Cancel
current thread if its thread number is greater than desired thread
count.
* workqueue.cc (Workqueue_threader_single::should_cancel_thread):
Add thread_number parameter.
(Workqueue::should_cancel_thread): Likewise.
(Workqueue::find_runnable_or_wait): Pass thread_number to
should_cancel_thread.
* workqueue.h (Workqueue::should_cancel_thread): Add thread_number
parameter.
+2011-07-28 Cary Coutant <ccoutant@google.com>
+
+ * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
+ Add thread_number parameter.
+ (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
+ * workqueue-threads.cc
+ (Workqueue_threader_threadpool::should_cancel_thread): Cancel
+ current thread if its thread number is greater than desired thread
+ count.
+ * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
+ Add thread_number parameter.
+ (Workqueue::should_cancel_thread): Likewise.
+ (Workqueue::find_runnable_or_wait): Pass thread_number to
+ should_cancel_thread.
+ * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
+ parameter.
+
2011-07-22 Sriraman Tallam <tmsriram@google.com>
* symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
// Return whether to cancel the current thread.
virtual bool
- should_cancel_thread() = 0;
+ should_cancel_thread(int thread_number) = 0;
protected:
// Get the Workqueue.
// Return whether to cancel a thread.
bool
- should_cancel_thread();
+ should_cancel_thread(int thread_number);
// Process all tasks. This keeps running until told to cancel.
void
// 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_)
{
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;
{ gold_assert(thread_count > 0); }
bool
- should_cancel_thread()
+ should_cancel_thread(int)
{ return false; }
};
// Return whether to cancel the current thread.
inline bool
-Workqueue::should_cancel_thread()
+Workqueue::should_cancel_thread(int thread_number)
{
- return this->threader_->should_cancel_thread();
+ return this->threader_->should_cancel_thread(thread_number);
}
// Find a runnable task in TASKS. Return NULL if none could be found.
return NULL;
}
- if (this->should_cancel_thread())
+ if (this->should_cancel_thread(thread_number))
return NULL;
gold_debug(DEBUG_TASK, "%3d sleeping", thread_number);
// Return whether to cancel this thread.
bool
- should_cancel_thread();
+ should_cancel_thread(int thread_number);
// Master Workqueue lock. This controls access to the following
// member variables.