mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Fix data race problem
PiperOrigin-RevId: 485414615
This commit is contained in:
@@ -50,9 +50,11 @@ TEST(PrngTest, NextInt32GeneratesDifferentValues) {
|
||||
}
|
||||
|
||||
TEST(PrngTest, NextInt32AcrossThreads) {
|
||||
absl::Mutex mutex;
|
||||
Prng prng;
|
||||
std::set<int32_t> values;
|
||||
auto func = [&prng, &values]() {
|
||||
auto func = [&prng, &values, &mutex]() {
|
||||
absl::MutexLock lock(&mutex);
|
||||
auto value = prng.NextInt32();
|
||||
EXPECT_LE(value, std::numeric_limits<std::int32_t>::max());
|
||||
EXPECT_GE(value, std::numeric_limits<std::int32_t>::min());
|
||||
|
||||
Reference in New Issue
Block a user