diff options
-rw-r--r-- | util/concurrency/value.h | 13 | ||||
-rw-r--r-- | util/concurrency/vars.cpp | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/util/concurrency/value.h b/util/concurrency/value.h index 35564d1cd13..897fa95af1e 100644 --- a/util/concurrency/value.h +++ b/util/concurrency/value.h @@ -21,6 +21,7 @@ #pragma once #include "mutex.h" +#include "spin_lock.h" namespace mongo { @@ -47,31 +48,31 @@ namespace mongo { class DiagStr { string _s; - static SimpleMutex m; + mutable SpinLock m; public: DiagStr(const DiagStr& r) : _s(r.get()) { } DiagStr() { } bool empty() const { - SimpleMutex::scoped_lock lk(m); + scoped_spinlock lk(m); return _s.empty(); } string get() const { - SimpleMutex::scoped_lock lk(m); + scoped_spinlock lk(m); return _s; } void set(const char *s) { - SimpleMutex::scoped_lock lk(m); + scoped_spinlock lk(m); _s = s; } void set(const string& s) { - SimpleMutex::scoped_lock lk(m); + scoped_spinlock lk(m); _s = s; } operator string() const { return get(); } void operator=(const string& s) { set(s); } void operator=(const DiagStr& rhs) { - SimpleMutex::scoped_lock lk(m); + scoped_spinlock lk(m); _s = rhs.get(); } }; diff --git a/util/concurrency/vars.cpp b/util/concurrency/vars.cpp index 669725a1492..b561ccce003 100644 --- a/util/concurrency/vars.cpp +++ b/util/concurrency/vars.cpp @@ -22,8 +22,6 @@ namespace mongo { - SimpleMutex DiagStr::m("diags"); - // intentional leak. otherwise destructor orders can be problematic at termination. MutexDebugger &mutexDebugger = *(new MutexDebugger()); |