summaryrefslogtreecommitdiff
path: root/src/mongo/util/concurrency
diff options
context:
space:
mode:
authorRahul Sundararaman <rahul.sundararaman@mongodb.com>2019-12-09 18:32:45 +0000
committerevergreen <evergreen@mongodb.com>2019-12-09 18:32:45 +0000
commit4f00d6e3d7e54a2d131b8216d4b4ef9bfd7a7c6b (patch)
tree97b83f3c954bd475f8eb5d94f592eca57a5018f7 /src/mongo/util/concurrency
parent1f32f6c3952581833482a1c3b0b7ab913b60943f (diff)
downloadmongo-4f00d6e3d7e54a2d131b8216d4b4ef9bfd7a7c6b.tar.gz
SERVER-44155 Validate a subset of latches of all levels
Diffstat (limited to 'src/mongo/util/concurrency')
-rw-r--r--src/mongo/util/concurrency/notification.h4
-rw-r--r--src/mongo/util/concurrency/thread_pool.h3
-rw-r--r--src/mongo/util/concurrency/ticketholder.h6
3 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/util/concurrency/notification.h b/src/mongo/util/concurrency/notification.h
index 379b6e10d9a..359a22a3258 100644
--- a/src/mongo/util/concurrency/notification.h
+++ b/src/mongo/util/concurrency/notification.h
@@ -36,6 +36,7 @@
#include "mongo/stdx/condition_variable.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/duration.h"
+#include "mongo/util/hierarchical_acquisition.h"
#include "mongo/util/time_support.h"
namespace mongo {
@@ -110,7 +111,8 @@ public:
}
private:
- mutable Mutex _mutex = MONGO_MAKE_LATCH("Notification::_mutex");
+ mutable Mutex _mutex =
+ MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "Notification::_mutex");
stdx::condition_variable _condVar;
// Protected by mutex and only moves from not-set to set once
diff --git a/src/mongo/util/concurrency/thread_pool.h b/src/mongo/util/concurrency/thread_pool.h
index 91981d1c808..c178f1d1a8d 100644
--- a/src/mongo/util/concurrency/thread_pool.h
+++ b/src/mongo/util/concurrency/thread_pool.h
@@ -38,6 +38,7 @@
#include "mongo/stdx/condition_variable.h"
#include "mongo/stdx/thread.h"
#include "mongo/util/concurrency/thread_pool_interface.h"
+#include "mongo/util/hierarchical_acquisition.h"
#include "mongo/util/time_support.h"
namespace mongo {
@@ -213,7 +214,7 @@ private:
const Options _options;
// Mutex guarding all non-const member variables.
- mutable Mutex _mutex = MONGO_MAKE_LATCH("ThreadPool::_mutex");
+ mutable Mutex _mutex = MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "ThreadPool::_mutex");
// This variable represents the lifecycle state of the pool.
//
diff --git a/src/mongo/util/concurrency/ticketholder.h b/src/mongo/util/concurrency/ticketholder.h
index af9baa934ed..ad7b2e92a29 100644
--- a/src/mongo/util/concurrency/ticketholder.h
+++ b/src/mongo/util/concurrency/ticketholder.h
@@ -36,6 +36,7 @@
#include "mongo/platform/mutex.h"
#include "mongo/stdx/condition_variable.h"
#include "mongo/util/concurrency/mutex.h"
+#include "mongo/util/hierarchical_acquisition.h"
#include "mongo/util/time_support.h"
namespace mongo {
@@ -87,13 +88,14 @@ private:
// You can read _outof without a lock, but have to hold _resizeMutex to change.
AtomicWord<int> _outof;
- Mutex _resizeMutex = MONGO_MAKE_LATCH("TicketHolder::_resizeMutex");
+ Mutex _resizeMutex =
+ MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "TicketHolder::_resizeMutex");
#else
bool _tryAcquire();
AtomicWord<int> _outof;
int _num;
- Mutex _mutex = MONGO_MAKE_LATCH("TicketHolder::_mutex");
+ Mutex _mutex = MONGO_MAKE_LATCH(HierarchicalAcquisitionLevel(0), "TicketHolder::_mutex");
stdx::condition_variable _newTicket;
#endif
};