Skip to content

Commit 3dbfe3f

Browse files
committed
Fix test, thanks to Vlad.
1 parent cc7e318 commit 3dbfe3f

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/jrd/tests/LockManagerTest.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <atomic>
44
#include <latch>
55
#include <memory>
6-
#include <mutex>
76
#include <thread>
87
#include <vector>
98
#include "../common/status.h"
@@ -74,11 +73,10 @@ BOOST_AUTO_TEST_CASE(LockUnlockTest, *boost::unit_test::disabled())
7473

7574
std::vector<std::thread> threads;
7675
std::latch latch(THREAD_COUNT);
77-
std::mutex mutex;
7876

7977
for (unsigned threadNum = 0u; threadNum < THREAD_COUNT; ++threadNum)
8078
{
81-
threads.emplace_back([&]() {
79+
threads.emplace_back([&, threadNum]() {
8280
const UCHAR LOCK_KEY[] = {'1'};
8381
FbLocalStatus statusVector;
8482
LOCK_OWNER_T ownerId = threadNum + 1;
@@ -90,8 +88,6 @@ BOOST_AUTO_TEST_CASE(LockUnlockTest, *boost::unit_test::disabled())
9088

9189
for (unsigned i = 0; i < ITERATION_COUNT; ++i)
9290
{
93-
// std::lock_guard mutexGuard(mutex);
94-
9591
const auto lockId = lockManager->enqueue(callbacks, &statusVector, 0,
9692
LCK_expression, LOCK_KEY, sizeof(LOCK_KEY), LCK_EX, nullptr, nullptr, 0, LCK_WAIT, ownerHandle);
9793

@@ -111,9 +107,8 @@ BOOST_AUTO_TEST_CASE(LockUnlockTest, *boost::unit_test::disabled())
111107
for (auto& thread : threads)
112108
thread.join();
113109

114-
BOOST_CHECK_EQUAL(lockFail + lockSuccess, THREAD_COUNT * ITERATION_COUNT);
115-
// BOOST_CHECK_EQUAL(lockFail.load(), 0u);
116-
// BOOST_CHECK_EQUAL(lockSuccess, THREAD_COUNT * ITERATION_COUNT);
110+
BOOST_CHECK_EQUAL(lockFail.load(), 0u);
111+
BOOST_CHECK_EQUAL(lockSuccess, THREAD_COUNT * ITERATION_COUNT);
117112

118113
lockManager.reset();
119114
}

0 commit comments

Comments
 (0)