Bug 1753350 Don't block PBackgroundParent thread while the main thread processes...
commit33229c7294e1a21c4c86fe58b5e6a1849cdace97
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 16 Mar 2022 04:06:32 +0000 (16 04:06 +0000)
committerKarl Tomlinson <karlt+@karlt.net>
Wed, 16 Mar 2022 04:06:32 +0000 (16 04:06 +0000)
tree5a426b29687a63c506d44675a104d14218eac9d2
parentdfd09d19d591d56d18851ce20c8f891293f009d1
Bug 1753350 Don't block PBackgroundParent thread while the main thread processes its queued tasks r=jib

Assumptions about safety of waiting on other threads are very risky when the
threads are shared with other consumers that may be making different
assumptions.  cf. https://phabricator.services.mozilla.com/D29701#872962

The thread creation hop was introduced under the assumption that creating and
joining threads from different threads would be problematic.
https://bugzilla.mozilla.org/show_bug.cgi?id=1209987#c6
No-one identified any particular OS that was problematic.

https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread
says
> When a thread terminates, the thread object attains a signaled state,
> satisfying any threads that were waiting on the object.

man 3p pthread_join says
> The results of multiple simultaneous calls to pthread_join() specifying the
> same target thread are undefined.

Differential Revision: https://phabricator.services.mozilla.com/D140021
dom/media/systemservices/CamerasParent.cpp
dom/media/systemservices/CamerasParent.h
ipc/glue/BackgroundParentImpl.cpp
ipc/glue/BackgroundParentImpl.h