diff --git a/netwerk/base/nsStreamTransportService.cpp b/netwerk/base/nsStreamTransportService.cpp index 7a3bbace62a8..3810ac8dc5fa 100644 --- a/netwerk/base/nsStreamTransportService.cpp +++ b/netwerk/base/nsStreamTransportService.cpp @@ -252,6 +252,7 @@ nsStreamTransportService::~nsStreamTransportService() { nsresult nsStreamTransportService::Init() { // Can't be used multithreaded before this + PUSH_IGNORE_THREAD_SAFETY MOZ_ASSERT(!mPool); mPool = new nsThreadPool(); @@ -261,6 +262,7 @@ nsresult nsStreamTransportService::Init() { mPool->SetIdleThreadLimit(5); mPool->SetIdleThreadTimeoutRegressive(true); mPool->SetIdleThreadTimeout(PR_SecondsToInterval(30)); + POP_THREAD_SAFETY nsCOMPtr obsSvc = mozilla::services::GetObserverService(); if (obsSvc) obsSvc->AddObserver(this, "xpcom-shutdown-threads", false); diff --git a/netwerk/base/nsStreamTransportService.h b/netwerk/base/nsStreamTransportService.h index d89680803fec..67611dfb7174 100644 --- a/netwerk/base/nsStreamTransportService.h +++ b/netwerk/base/nsStreamTransportService.h @@ -45,13 +45,12 @@ class nsStreamTransportService final : public nsIStreamTransportService, private: ~nsStreamTransportService(); - nsCOMPtr mPool; + nsCOMPtr mPool GUARDED_BY(mShutdownLock); DataMutex>> mScheduledDelayedRunnables; - mozilla::Mutex mShutdownLock MOZ_UNANNOTATED{ - "nsStreamTransportService.mShutdownLock"}; - bool mIsShutdown{false}; + mozilla::Mutex mShutdownLock{"nsStreamTransportService.mShutdownLock"}; + bool mIsShutdown GUARDED_BY(mShutdownLock) {false}; }; } // namespace net