Bug 1470907 - Call AsyncShutdown for threads at the end of nsHostResolver::ThreadFunc r=froydnj
MozReview-Commit-ID: 2M8Qn8KDfdx
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -1857,16 +1857,20 @@ nsHostResolver::ThreadFunc()
if (LOOKUP_RESOLVEAGAIN == CompleteLookup(rec, status, ai, rec->pb)) {
// leave 'rec' assigned and loop to make a renewed host resolve
LOG(("DNS lookup thread - Re-resolving host [%s].\n", rec->host.get()));
} else {
rec = nullptr;
}
} while(true);
+ nsCOMPtr<nsIThread> thread = NS_GetCurrentThread();
+ NS_DispatchToMainThread(NS_NewRunnableFunction("nsHostResolver::ThreadFunc::AsyncShutdown", [thread]() {
+ thread->AsyncShutdown();
+ }));
mThreadCount--;
LOG(("DNS lookup thread - queue empty, thread finished.\n"));
}
void
nsHostResolver::SetCacheLimits(uint32_t aMaxCacheEntries,
uint32_t aDefaultCacheEntryLifetime,
uint32_t aDefaultGracePeriod)