URL
https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 27 |
Rev 159 |
Line 172... |
Line 172... |
}
|
}
|
|
|
// Return whether the current thread should be cancelled.
|
// Return whether the current thread should be cancelled.
|
|
|
bool
|
bool
|
Workqueue_threader_threadpool::should_cancel_thread()
|
Workqueue_threader_threadpool::should_cancel_thread(int thread_number)
|
{
|
{
|
// Fast exit without taking a lock.
|
// Fast exit without taking a lock.
|
if (!this->check_thread_count_)
|
if (!this->check_thread_count_)
|
return false;
|
return false;
|
|
|
{
|
{
|
Hold_lock hl(this->lock_);
|
Hold_lock hl(this->lock_);
|
if (this->threads_ > this->desired_thread_count_)
|
if (thread_number > this->desired_thread_count_)
|
{
|
{
|
--this->threads_;
|
--this->threads_;
|
|
if (this->threads_ <= this->desired_thread_count_)
|
|
this->check_thread_count_ = 0;
|
return true;
|
return true;
|
}
|
}
|
this->check_thread_count_ = 0;
|
|
}
|
}
|
|
|
return false;
|
return false;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.