Bug 1705365 Comment 10 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Thanks for the investigation!

Looking at the code differences of `nsAppShell::ProcessNextNativeEvent` between Mac and Win, I stumbled over [`mozilla::BackgroundHangMonitor().NotifyWait();`](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/widget/cocoa/nsAppShell.mm#612-614) **outside** the loop in the Mac case and [**inside**](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/widget/windows/nsAppShell.cpp#741-745) under Windows.

Could it be that we are just lucky under Windows that the thread gets marked as hanging and the loop aborted in time before the shutdown timer fires and we should invest some more thought in synchronizing BackgroundHangMonitor with AppShutdown in general?
Thanks for the investigation!

Looking at the code differences of `nsAppShell::ProcessNextNativeEvent` between Mac and Win, I stumbled over [`mozilla::BackgroundHangMonitor().NotifyWait();`](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/widget/cocoa/nsAppShell.mm#612-614) **outside** the loop in the Mac case and [**inside**](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/widget/windows/nsAppShell.cpp#741-745) under Windows.

Could it be that we are just lucky under Windows that the thread gets marked as hanging and the loop aborted in time before the shutdown timer fires and we should invest some more thought in synchronizing `BackgroundHangMonitor` with `AppShutdown` in general?
Thanks for the investigation!

Looking at the code differences of `nsAppShell::ProcessNextNativeEvent` between Mac and Win, I stumbled over [`mozilla::BackgroundHangMonitor().NotifyWait();`](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/widget/cocoa/nsAppShell.mm#612-614) **outside** the loop in the Mac case and [**inside**](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/widget/windows/nsAppShell.cpp#741-745) under Windows.

Could it be that we are just lucky under Windows that the thread gets marked as hanging and the loop aborted in time before the shutdown timer fires and we should invest some more thought in synchronizing `BackgroundHangMonitor` with `AppShutdown` in general?

**Edit:** Probably I misunderstood what `BackgroundHangMonitor` actually does - nothing but record telemetry? And it seems to be [disabled except for nightly anyway](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/toolkit/components/backgroundhangmonitor/moz.build#17-33). Sorry for the noise.
Thanks for the investigation!

> Looking at the code differences of `nsAppShell::ProcessNextNativeEvent` between Mac and Win, I stumbled over [`mozilla::BackgroundHangMonitor().NotifyWait();`](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/widget/cocoa/nsAppShell.mm#612-614) **outside** the loop in the Mac case and [**inside**](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/widget/windows/nsAppShell.cpp#741-745) under Windows.

> Could it be that we are just lucky under Windows that the thread gets marked as hanging and the loop aborted in time before the shutdown timer fires and we should invest some more thought in synchronizing `BackgroundHangMonitor` with `AppShutdown` in general?

**Edit:** Probably I misunderstood what `BackgroundHangMonitor` actually does - nothing but record telemetry? And it seems to be [disabled except for nightly anyway](https://searchfox.org/mozilla-central/rev/15f6b60e343c536305a5aa81e2020d7b87f93158/toolkit/components/backgroundhangmonitor/moz.build#17-33). Sorry for the noise.

Back to Bug 1705365 Comment 10