Skip to content

Commit

Permalink
Improve scan test
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Dec 29, 2023
1 parent 662d784 commit 4a6f0be
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/scan-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ TEST(scan_test, lock) {
write_end.close();
});

std::atomic<int> count(0);
fmt::buffered_file f = read_end.fdopen("r");
auto fun = [&]() {
int value = 0;
Expand All @@ -161,12 +162,16 @@ TEST(scan_test, lock) {
EXPECT_EQ(value, 42);
break;
}
++count;
}
};
std::thread consumer1(fun);
std::thread consumer2(fun);

producer.join();
consumer1.join();
consumer2.join();
EXPECT_EQ(count, 1000);

}
#endif // FMT_USE_FCNTL

0 comments on commit 4a6f0be

Please sign in to comment.