summaryrefslogtreecommitdiff
path: root/src/mongo/db/client.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-03-07 16:03:30 -0500
committerMathias Stearn <mathias@10gen.com>2017-03-24 16:13:26 -0400
commit77f7e96fdccfdfb1313a1a2ac57ebab8ed0e8882 (patch)
treefc92545209a2d70826fdc949f8aeb4003944529a /src/mongo/db/client.cpp
parentfd46b39bd957df28fa2273bf5e4dcbb1765e4026 (diff)
downloadmongo-77f7e96fdccfdfb1313a1a2ac57ebab8ed0e8882.tar.gz
SERVER-27727 Make threadName a native thread_local so debuggers can get to it
Diffstat (limited to 'src/mongo/db/client.cpp')
-rw-r--r--src/mongo/db/client.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp
index 339fcdc9d9d..9fdb3ce6cf6 100644
--- a/src/mongo/db/client.cpp
+++ b/src/mongo/db/client.cpp
@@ -53,21 +53,21 @@ namespace mongo {
TSP_DECLARE(ServiceContext::UniqueClient, currentClient)
TSP_DEFINE(ServiceContext::UniqueClient, currentClient)
-void Client::initThreadIfNotAlready(const char* desc) {
+void Client::initThreadIfNotAlready(StringData desc) {
if (currentClient.getMake()->get())
return;
initThread(desc);
}
void Client::initThreadIfNotAlready() {
- initThreadIfNotAlready(getThreadName().c_str());
+ initThreadIfNotAlready(getThreadName());
}
-void Client::initThread(const char* desc, transport::SessionHandle session) {
+void Client::initThread(StringData desc, transport::SessionHandle session) {
initThread(desc, getGlobalServiceContext(), std::move(session));
}
-void Client::initThread(const char* desc,
+void Client::initThread(StringData desc,
ServiceContext* service,
transport::SessionHandle session) {
invariant(currentClient.getMake()->get() == nullptr);
@@ -76,10 +76,10 @@ void Client::initThread(const char* desc,
if (session) {
fullDesc = str::stream() << desc << session->id();
} else {
- fullDesc = desc;
+ fullDesc = desc.toString();
}
- setThreadName(fullDesc.c_str());
+ setThreadName(fullDesc);
// Create the client obj, attach to thread
*currentClient.get() = service->makeClient(fullDesc, std::move(session));