From edc33dea572a671a9c27edf0ecd9d5b5d88a1cdd Mon Sep 17 00:00:00 2001 From: Jens Stutte Date: Thu, 21 Oct 2021 12:46:06 +0000 Subject: [PATCH] Bug 1735129: Add thread's name in nsThread::Shutdown's SpinEventLoopUntil annotation. r=xpcom-reviewers,nika Differential Revision: https://phabricator.services.mozilla.com/D128270 --- xpcom/threads/nsThread.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index 282f52ec824c..e6c5a28d371d 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -855,10 +855,14 @@ nsThread::Shutdown() { NotNull context = WrapNotNull(maybeContext); + // If we are going to hang here we want to see the thread's name + nsAutoCString threadName; + GetThreadName(threadName); + // Process events on the current thread until we receive a shutdown ACK. // Allows waiting; ensure no locks are held that would deadlock us! SpinEventLoopUntil( - "nsThread::Shutdown"_ns, + "nsThread::Shutdown: "_ns + threadName, [&, context]() { return !context->mAwaitingShutdownAck; }, context->mJoiningThread);