Bug 1861627 join MockCubeb thread from main thread r=padenot
commit85887c9872cf76dcf70cb57b7bab58a3decbdcb2
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 2 Nov 2023 22:15:34 +0000 (2 22:15 +0000)
committerKarl Tomlinson <karlt+@karlt.net>
Thu, 2 Nov 2023 22:15:34 +0000 (2 22:15 +0000)
tree9bfdf898d10fa7a3ee7658861b43e02eb943803b
parent3ecc7966f4f9e5ed8f4d5bca54f84a564faa5db2
Bug 1861627 join MockCubeb thread from main thread r=padenot

The main thread is available later in shutdown than the background thread pool
[1] and leaks [2] the std::thread without crashing if no longer available for
the join().

The MockCubeb thread function is about to return so the main thread should not
need to wait long.

[1]
https://searchfox.org/mozilla-central/rev/01a0d864a9442d0fe2dbd4beee5c88b9b46e96bd/xpcom/build/XPCOMInit.cpp#628,668
[2]
https://searchfox.org/mozilla-central/rev/01a0d864a9442d0fe2dbd4beee5c88b9b46e96bd/xpcom/threads/nsThreadUtils.cpp#233

Differential Revision: https://phabricator.services.mozilla.com/D192458
dom/media/gtest/MockCubeb.cpp