The way idle nsThreadPool threads wait with a timeout doesn't work well with
shutdown from nsThreadManager.
nsThreadPool doesn't need to use nsIThread for its threads. The nsIThread
interface is not useful for threads running in an nsThreadPool.
The nsIEventTarget on the nsIThreadPool should be used for dispatching events,
not an interface on the individual threads, and the threads don't need an
nsEventQueue because they use the nsEventQueue on the nsThreadPool.
Shutdown of single event threads is easier than running nested event loops for
nsIThreads, avoiding the multilevel nested event loop situations when several
threads finish and are shutdown. While the ThreadFunc is running, a nested
event loop is still used in Shutdown() in case some consumers might need it
and because that is the documented API.
This also simplifies thread creation, avoiding races that could mean there was
temporarily an extra thread or more.
--HG--
extra : transplant_source : %F7%14%16%12%EF%E9%84%19D%26%3C%FE%1F%EC%FF%A3%BAG%C4%F3