summaryrefslogtreecommitdiff
path: root/src/mongo/db/transaction_api_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/transaction_api_test.cpp')
-rw-r--r--src/mongo/db/transaction_api_test.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/transaction_api_test.cpp b/src/mongo/db/transaction_api_test.cpp
index 90a8daf4366..bcfb8ba5815 100644
--- a/src/mongo/db/transaction_api_test.cpp
+++ b/src/mongo/db/transaction_api_test.cpp
@@ -1203,7 +1203,6 @@ TEST_F(TxnAPITest, UnyieldsAfterCancellation) {
auto killerThread = stdx::thread([&txnApiStarted, &opCtxKilled, opCtx = opCtx()] {
txnApiStarted.countDownAndWait();
opCtx->markKilled();
- opCtxKilled.countDownAndWait();
});
auto swResult = txnWithRetries().runNoThrow(
@@ -1231,7 +1230,11 @@ TEST_F(TxnAPITest, UnyieldsAfterCancellation) {
ASSERT_EQ(resourceYielder()->timesYielded(), 1);
ASSERT_EQ(resourceYielder()->timesUnyielded(), 1);
+ opCtxKilled.countDownAndWait();
killerThread.join();
+
+ // Wait until the API callback has completed before letting the barriers go out of scope.
+ waitForAllEarlierTasksToComplete();
}
TEST_F(TxnAPITest, ClientSession_UsesNonRetryableInternalSession) {