summaryrefslogtreecommitdiff
path: root/src/mongo/util/fail_point.h
diff options
context:
space:
mode:
authorCheahuychou Mao <cheahuychou.mao@mongodb.com>2019-12-03 15:51:38 +0000
committerevergreen <evergreen@mongodb.com>2019-12-03 15:51:38 +0000
commit966d9b880ad80b6d126f5bb4ad777312562cd93e (patch)
tree1b233ffe756892108717fe6543895c571d9b598f /src/mongo/util/fail_point.h
parenta0831c75a97b935f30c2987a67a3ee6c92fab49c (diff)
downloadmongo-966d9b880ad80b6d126f5bb4ad777312562cd93e.tar.gz
SERVER-44775 Make pauseWhileSet increment _timesEntered once
Diffstat (limited to 'src/mongo/util/fail_point.h')
-rw-r--r--src/mongo/util/fail_point.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/util/fail_point.h b/src/mongo/util/fail_point.h
index dd8bd8c9916..d0a0c4ea5d8 100644
--- a/src/mongo/util/fail_point.h
+++ b/src/mongo/util/fail_point.h
@@ -318,10 +318,12 @@ public:
/**
* Take 100msec pauses for as long as the FailPoint is active.
- * This uses `shouldFail()` and therefore affects FailPoint counters.
+ * This calls `shouldFail()` with kFirstTimeEntered once and with kEnteredAlready thereafter, so
+ * affects FailPoint counters once.
*/
void pauseWhileSet() {
- while (MONGO_unlikely(shouldFail(kEnteredAlready))) {
+ for (auto entryMode = kFirstTimeEntered; MONGO_unlikely(shouldFail(entryMode));
+ entryMode = kEnteredAlready) {
sleepmillis(100);
}
}
@@ -332,7 +334,8 @@ public:
* OperationContext).
*/
void pauseWhileSet(OperationContext* opCtx) {
- while (MONGO_unlikely(shouldFail(kEnteredAlready))) {
+ for (auto entryMode = kFirstTimeEntered; MONGO_unlikely(shouldFail(entryMode));
+ entryMode = kEnteredAlready) {
opCtx->sleepFor(Milliseconds(100));
}
}