summaryrefslogtreecommitdiff
path: root/src/mongo/db/concurrency/lock_manager_test_help.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/concurrency/lock_manager_test_help.h')
-rw-r--r--src/mongo/db/concurrency/lock_manager_test_help.h60
1 files changed, 29 insertions, 31 deletions
diff --git a/src/mongo/db/concurrency/lock_manager_test_help.h b/src/mongo/db/concurrency/lock_manager_test_help.h
index 1650ca0806a..9344ee67a32 100644
--- a/src/mongo/db/concurrency/lock_manager_test_help.h
+++ b/src/mongo/db/concurrency/lock_manager_test_help.h
@@ -33,43 +33,41 @@
namespace mongo {
- class LockerForTests : public LockerImpl<false> {
- public:
- explicit LockerForTests(LockMode globalLockMode) {
- lockGlobal(globalLockMode);
- }
+class LockerForTests : public LockerImpl<false> {
+public:
+ explicit LockerForTests(LockMode globalLockMode) {
+ lockGlobal(globalLockMode);
+ }
- ~LockerForTests() {
- unlockAll();
- }
- };
+ ~LockerForTests() {
+ unlockAll();
+ }
+};
- class TrackingLockGrantNotification : public LockGrantNotification {
- public:
- TrackingLockGrantNotification() : numNotifies(0), lastResult(LOCK_INVALID) {
+class TrackingLockGrantNotification : public LockGrantNotification {
+public:
+ TrackingLockGrantNotification() : numNotifies(0), lastResult(LOCK_INVALID) {}
- }
+ virtual void notify(ResourceId resId, LockResult result) {
+ numNotifies++;
+ lastResId = resId;
+ lastResult = result;
+ }
- virtual void notify(ResourceId resId, LockResult result) {
- numNotifies++;
- lastResId = resId;
- lastResult = result;
- }
+public:
+ int numNotifies;
- public:
- int numNotifies;
+ ResourceId lastResId;
+ LockResult lastResult;
+};
- ResourceId lastResId;
- LockResult lastResult;
- };
+struct LockRequestCombo : public LockRequest, TrackingLockGrantNotification {
+public:
+ explicit LockRequestCombo(Locker* locker) {
+ initNew(locker, this);
+ }
+};
- struct LockRequestCombo : public LockRequest, TrackingLockGrantNotification {
- public:
- explicit LockRequestCombo (Locker* locker) {
- initNew(locker, this);
- }
- };
-
-} // namespace mongo
+} // namespace mongo