diff options
author | Ben Caimano <ben.caimano@10gen.com> | 2020-01-29 18:34:54 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-01-30 00:07:42 +0000 |
commit | 28d4d9cb69b68c759a76851675390cec29855a28 (patch) | |
tree | c551c33cb8ebdd3fab9fe56b6366f18c8b5b0039 /src/mongo/util/latch_analyzer.cpp | |
parent | 84dc6fcc49eb679c7fe7a5614f496c65e95576fb (diff) | |
download | mongo-28d4d9cb69b68c759a76851675390cec29855a28.tar.gz |
Revert "SERVER-45793 Improve mongo::Mutex contract"
This reverts commit 695146e648e032e04d97bb0b4de873272c242f04.
Diffstat (limited to 'src/mongo/util/latch_analyzer.cpp')
-rw-r--r-- | src/mongo/util/latch_analyzer.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mongo/util/latch_analyzer.cpp b/src/mongo/util/latch_analyzer.cpp index b60254886d2..2062daa3d9a 100644 --- a/src/mongo/util/latch_analyzer.cpp +++ b/src/mongo/util/latch_analyzer.cpp @@ -59,9 +59,9 @@ auto kLatchViolationKey = "hierarchicalAcquisitionLevelViolations"_sd; const auto getLatchAnalyzer = ServiceContext::declareDecoration<LatchAnalyzer>(); /** - * DiagnosticListener sub-class to implement updating set in LatchSetState + * LockListener sub-class to implement updating set in LatchSetState */ -class DiagnosticListener : public latch_detail::DiagnosticListener { +class LockListener : public Mutex::LockListener { public: void onContendedLock(const Identity& id) override { if (auto client = Client::getCurrent()) { @@ -88,10 +88,13 @@ public: } }; -// Register our DiagnosticListener -MONGO_INITIALIZER_GENERAL(LatchAnalysis, (/* NO PREREQS */), ("FinalizeDiagnosticListeners")) +// Register our LockListener with the Mutex class +MONGO_INITIALIZER_GENERAL(LatchAnalysis, (/* NO PREREQS */), ("FinalizeLockListeners")) (InitializerContext* context) { - latch_detail::installDiagnosticListener<DiagnosticListener>(); + + // Intentionally leaked, people use Latches in detached threads + static auto& listener = *new LockListener; + Mutex::addLockListener(&listener); return Status::OK(); } |