[TaskScheduler]: Distribute waking-up workers.
This CL distributes waking-up workers to avoid having 1 thread waking-up many workers. This implies: - Cap num_workers_to_wakeup to 2 in EnsureEnoughWorkersLockRequired. - Call EnsureEnoughWorkersLockRequired from GetWork(), so it can wakeup more workers (which will, in turn wakeup other workers). This is ground work for supporting TaskSource with concurrency > 1 and shouldn't have a big impact currently since it's rare for EnsureEnoughWorkersLockRequired() to wakeup many workers. RepeatedWillBlockDoesNotCreateTooManyWorkers had to be adapted; The test didn't take into account the idle thread, and it seems there was no code path maintaining the idle thread in this situation. This CL changes this and an idle thread is now created, which the test need to take into account. TBR=fdoray@chromium.org Change-Id: If2479b703ff6d85a0f11e73908ff1e09ed249c1a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1474462 Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by:Gabriel Charette <gab@chromium.org> Cr-Commit-Position: refs/heads/master@{#638407}
Showing
Please register or sign in to comment