diff options
author | Benety Goh <benety@mongodb.com> | 2020-05-15 11:18:28 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-05-15 15:41:45 +0000 |
commit | e9d23f4045e9a79bf6caa325da4190da2deb3cc1 (patch) | |
tree | a6d651f297bc3c466faac787caeb9ea22c564950 /src/mongo/util/fail_point.h | |
parent | 2787a803ac9a79b3bd55f73d400680e3ba975497 (diff) | |
download | mongo-e9d23f4045e9a79bf6caa325da4190da2deb3cc1.tar.gz |
SERVER-48171 FailPoint wait functions accept Interruptible
Diffstat (limited to 'src/mongo/util/fail_point.h')
-rw-r--r-- | src/mongo/util/fail_point.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/mongo/util/fail_point.h b/src/mongo/util/fail_point.h index c7a5f547b35..7467ce4d67a 100644 --- a/src/mongo/util/fail_point.h +++ b/src/mongo/util/fail_point.h @@ -35,11 +35,11 @@ #include "mongo/base/status.h" #include "mongo/base/status_with.h" #include "mongo/db/jsobj.h" -#include "mongo/db/operation_context.h" #include "mongo/platform/atomic_word.h" #include "mongo/platform/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/duration.h" +#include "mongo/util/interruptible.h" namespace mongo { @@ -272,11 +272,11 @@ public: EntryCountT waitForTimesEntered(EntryCountT targetTimesEntered) const noexcept; /** - * Like `waitForTimesEntered`, but interruptible via the `opCtx->sleepFor` mechanism. See - * `mongo::Interruptible::sleepFor` (Interruptible is a base class of - * OperationContext). + * Like `waitForTimesEntered`, but interruptible via the `interruptible->sleepFor` mechanism. + * See `mongo::Interruptible::sleepFor`. */ - EntryCountT waitForTimesEntered(OperationContext* opCtx, EntryCountT targetTimesEntered) const; + EntryCountT waitForTimesEntered(Interruptible* interruptible, + EntryCountT targetTimesEntered) const; /** * @returns a BSON object showing the current mode and data stored. @@ -338,14 +338,13 @@ public: } /** - * Like `pauseWhileSet`, but interruptible via the `opCtx->sleepFor` mechanism. See - * `mongo::Interruptible::sleepFor` (Interruptible is a base class of - * OperationContext). + * Like `pauseWhileSet`, but interruptible via the `interruptible->sleepFor` mechanism. See + * `mongo::Interruptible::sleepFor`. */ - void pauseWhileSet(OperationContext* opCtx) { + void pauseWhileSet(Interruptible* interruptible) { for (auto entryMode = kFirstTimeEntered; MONGO_unlikely(shouldFail(entryMode)); entryMode = kEnteredAlready) { - opCtx->sleepFor(Milliseconds(100)); + interruptible->sleepFor(Milliseconds(100)); } } |