mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1760647 - nsStreamTransportService thread-safety annotations r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D141656
This commit is contained in:
parent
d956dfa608
commit
0ba3cb38b1
@ -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<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
|
||||
if (obsSvc) obsSvc->AddObserver(this, "xpcom-shutdown-threads", false);
|
||||
|
@ -45,13 +45,12 @@ class nsStreamTransportService final : public nsIStreamTransportService,
|
||||
private:
|
||||
~nsStreamTransportService();
|
||||
|
||||
nsCOMPtr<nsIThreadPool> mPool;
|
||||
nsCOMPtr<nsIThreadPool> mPool GUARDED_BY(mShutdownLock);
|
||||
|
||||
DataMutex<nsTArray<RefPtr<DelayedRunnable>>> mScheduledDelayedRunnables;
|
||||
|
||||
mozilla::Mutex mShutdownLock MOZ_UNANNOTATED{
|
||||
"nsStreamTransportService.mShutdownLock"};
|
||||
bool mIsShutdown{false};
|
||||
mozilla::Mutex mShutdownLock{"nsStreamTransportService.mShutdownLock"};
|
||||
bool mIsShutdown GUARDED_BY(mShutdownLock) {false};
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
Loading…
Reference in New Issue
Block a user