Permalink
Browse files

put thread if in currentOp()

  • Loading branch information...
1 parent 5ae386a commit 8b8427c898518e550a5730097cd5888f26553c39 @erh erh committed May 29, 2011
Showing with 11 additions and 2 deletions.
  1. +10 −2 db/client.cpp
  2. +1 −0 db/client.h
View
@@ -96,6 +96,11 @@ namespace mongo {
_mp(p) {
_connectionId = setThreadName(desc);
_curOp = new CurOp( this );
+#ifndef _WINDOWS
+ stringstream temp;
+ temp << "0x" << hex << pthread_self();
+ _threadId = temp.str();
+#endif
scoped_lock bl(clientsMutex);
clients.insert(this);
}
@@ -387,9 +392,12 @@ namespace mongo {
clientStr << _remote.toString();
b.append("client", clientStr.str());
- if ( _client )
+ if ( _client ) {
b.append( "desc" , _client->desc() );
-
+ if ( _client->_threadId.size() )
+ b.append( "threadId" , _client->_threadId );
+ }
+
if ( ! _message.empty() ) {
if ( _progressMeter.isActive() ) {
StringBuilder buf(128);
View
@@ -101,6 +101,7 @@ namespace mongo {
private:
ConnectionId _connectionId; // > 0 for things "conn", 0 otherwise
+ string _threadId; // "" on non support systems
CurOp * _curOp;
Context * _context;
bool _shutdown;

0 comments on commit 8b8427c

Please sign in to comment.