From 0d2ca3e2c188604f0bfa6533f719ffebca8b5df4 Mon Sep 17 00:00:00 2001 From: Dwight Date: Wed, 6 Apr 2011 10:56:03 -0400 Subject: [PATCH] fix threading test --- db/common.cpp | 2 ++ dbtests/threadedtests.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/db/common.cpp b/db/common.cpp index 44bc54d0ab0..178453cccda 100644 --- a/db/common.cpp +++ b/db/common.cpp @@ -27,6 +27,8 @@ namespace mongo { MongoMutex &dbMutex( *(new MongoMutex("rw:dbMutex")) ); MongoMutex::MongoMutex(const char *name) : _m(name) { + static int n; + assert( ++n == 1 ); // below releasingWriteLock we assume MongoMutex is a singleton, and uses dbMutex ref above _remapPrivateViewRequested = false; } diff --git a/dbtests/threadedtests.cpp b/dbtests/threadedtests.cpp index 0cb04759a8c..4cda469ae59 100644 --- a/dbtests/threadedtests.cpp +++ b/dbtests/threadedtests.cpp @@ -73,7 +73,7 @@ namespace ThreadedTests { } private: virtual void setup() { - mm = new MongoMutex("MongoMutexTest"); + mm = &dbMutex; } virtual void subthread(int) { Client::initThread("mongomutextest");