mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
Improve parallelism of nsThreadPool
By taking the number of pending events into account when spawning a new thread
This commit is contained in:
@@ -84,7 +84,10 @@ nsThreadPool::PutEvent(nsIRunnable* aEvent)
|
||||
MOZ_ASSERT(mIdleCount <= (uint32_t)mThreads.Count(), "oops");
|
||||
|
||||
// Make sure we have a thread to service this event.
|
||||
if (mIdleCount == 0 && mThreads.Count() < (int32_t)mThreadLimit) {
|
||||
if (mThreads.Count() < (int32_t)mThreadLimit &&
|
||||
// Spawn a new thread if we don't have enough idle threads to serve
|
||||
// pending events immediately.
|
||||
mEvents.Count() >= mIdleCount) {
|
||||
spawnThread = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user