diff options
Diffstat (limited to 'util/util.cpp')
| -rw-r--r-- | util/util.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/util/util.cpp b/util/util.cpp index 216683a..4528e30 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; @@ -142,17 +150,6 @@ namespace mongo { struct UtilTest : public UnitTest { void run() { - assert( WrappingInt(0) <= WrappingInt(0) ); - assert( WrappingInt(0) <= WrappingInt(1) ); - assert( !(WrappingInt(1) <= WrappingInt(0)) ); - assert( (WrappingInt(0xf0000000) <= WrappingInt(0)) ); - assert( (WrappingInt(0xf0000000) <= WrappingInt(9000)) ); - assert( !(WrappingInt(300) <= WrappingInt(0xe0000000)) ); - - assert( tdiff(3, 4) == 1 ); - assert( tdiff(4, 3) == -1 ); - assert( tdiff(0xffffffff, 0) == 1 ); - assert( isPrime(3) ); assert( isPrime(2) ); assert( isPrime(13) ); @@ -184,7 +181,8 @@ namespace mongo { /* note: can't use malloc herein - may be in signal handler. logLockless() likely does not comply and should still be fixed todo - */ + likewise class string? + */ void rawOut( const string &s ) { if( s.empty() ) return; |
