diff options
author | Daniel Vitor Morilha <daniel.morilha@mongodb.com> | 2021-12-21 14:50:43 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-12-21 15:40:38 +0000 |
commit | 36cb5167bbe5053bb806f5c4c060a80b2cc791c0 (patch) | |
tree | 9e0db499827e10d61763191278905b7868b1427f /src/mongo/db/client.cpp | |
parent | 19080405d9c7d08b54e70228a92d237223f2885c (diff) | |
download | mongo-36cb5167bbe5053bb806f5c4c060a80b2cc791c0.tar.gz |
SERVER-42971 Restore original thread name upon ThreadClient destruction
Diffstat (limited to 'src/mongo/db/client.cpp')
-rw-r--r-- | src/mongo/db/client.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index 6982ad9e9db..7da46be32df 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -188,12 +188,14 @@ ThreadClient::ThreadClient(StringData desc, ServiceContext* serviceContext, transport::SessionHandle session) { invariantNoCurrentClient(); + _originalThreadName = ThreadName::get(ThreadContext::get()); Client::initThread(desc, serviceContext, std::move(session)); } ThreadClient::~ThreadClient() { invariant(currentClient); currentClient.reset(nullptr); + ThreadName::set(ThreadContext::get(), _originalThreadName); } Client* ThreadClient::get() const { |