Bug 1607138 - gXPCOMThreadsShutdown should be atomic r=xpcom-reviewers,mccr8

This commit makes `gXPCOMThreadsShutdown` atomic. I've deliberated on this one for a while because I was mostly interested in how timer threads may be trying to init during shutdown, but these aren't the only places where we are making accesses into `gXPCOMThreadsShutdown` so it should be made atomic regardless.

Differential Revision: https://phabricator.services.mozilla.com/D102486
This commit is contained in:
Kris Wright 2021-01-21 01:01:26 +00:00
parent b9f323e9a1
commit e5aed0986a
2 changed files with 5 additions and 2 deletions

View File

@ -148,7 +148,8 @@ nsresult nsLocalFileConstructor(nsISupports* aOuter, const nsIID& aIID,
nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = nullptr;
bool gXPCOMShuttingDown = false;
bool gXPCOMThreadsShutDown = false;
mozilla::Atomic<bool, mozilla::SequentiallyConsistent> gXPCOMThreadsShutDown(
false);
bool gXPCOMMainThreadEventsAreDoomed = false;
char16_t* gGREBinPath = nullptr;

View File

@ -10,6 +10,7 @@
#include "nscore.h"
#include "nsXPCOMCID.h"
#include "mozilla/Attributes.h"
#include "mozilla/Atomics.h"
#ifdef __cplusplus
# define DECL_CLASS(c) class c
@ -31,7 +32,8 @@ DECL_CLASS(nsIDebug2);
#ifdef __cplusplus
extern bool gXPCOMShuttingDown;
extern bool gXPCOMThreadsShutDown;
extern mozilla::Atomic<bool, mozilla::SequentiallyConsistent>
gXPCOMThreadsShutDown;
extern bool gXPCOMMainThreadEventsAreDoomed;
#endif