diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-09-09 12:28:03 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-09-09 13:44:15 -0400 |
commit | 21855b87fcee0d4c125ce8c02873e092a8a642bf (patch) | |
tree | 9a24c99b961a24bdcaf0840c20a78e0b28afe328 | |
parent | ff418fdac2591664a9bb1fe76be854483b136e1c (diff) | |
download | mongo-21855b87fcee0d4c125ce8c02873e092a8a642bf.tar.gz |
fix thread name setting when using conn
-rw-r--r-- | util/util.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/util/util.cpp b/util/util.cpp index 374895b1ee3..4528e300813 100644 --- a/util/util.cpp +++ b/util/util.cpp @@ -21,6 +21,7 @@ #include "file_allocator.h" #include "optime.h" #include "time_support.h" +#include "mongoutils/str.h" namespace mongo { @@ -46,6 +47,13 @@ namespace mongo { static unsigned N = 0; if ( strcmp( name , "conn" ) == 0 ) { + string* x = _threadName.get(); + if ( x && mongoutils::str::startsWith( *x , "conn" ) ) { + int n = atoi( x->c_str() + 4 ); + if ( n > 0 ) + return n; + warning() << "unexpected thread name [" << *x << "] parsed to " << n << endl; + } unsigned n = ++N; stringstream ss; ss << name << n; |