commit b0cc2184b03315b546d1621072341ac2c23a6f36
parent 7ec0d3439bf147f52e92fa9bdc5aca36cca796b8
Author: Jens Stutte <jstutte@mozilla.com>
Date: Wed, 3 Dec 2025 08:03:56 +0000
Bug 2003536 - Adjust an outdated comment in nsThreadPool::ShutdownThread. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D274760
Diffstat:
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/xpcom/threads/nsThreadPool.cpp b/xpcom/threads/nsThreadPool.cpp
@@ -232,16 +232,12 @@ nsresult nsThreadPool::PutEvent(already_AddRefed<nsIRunnable> aEvent,
void nsThreadPool::ShutdownThread(nsIThread* aThread) {
LOG(("THRD-P(%p) shutdown async [%p]\n", this, aThread));
- // This is either called by a threadpool thread that is out of work, or
- // a thread that attempted to create a threadpool thread and raced in
- // such a way that the newly created thread is no longer necessary.
- // In the first case, we must go to another thread to shut aThread down
- // (because it is the current thread). In the second case, we cannot
- // synchronously shut down the current thread (because then Dispatch() would
- // spin the event loop, and that could blow up the world), and asynchronous
- // shutdown requires this thread have an event loop (and it may not, see bug
- // 10204784). The simplest way to cover all cases is to asynchronously
- // shutdown aThread from the main thread.
+ // This is called by a threadpool thread that is out of work and exceeded
+ // its idle timeout. The thread has already been unregistered from the pool's
+ // bookkeeping and will go idle right after this call. We must go to another
+ // thread to shut it down completely (because it is the current thread).
+ // The simplest way to cover that case is to asynchronously shutdown aThread
+ // from the main thread.
// NOTE: If this fails, it's OK, as XPCOM shutdown will already have destroyed
// the nsThread for us.
SchedulerGroup::Dispatch(