Skip to content

prevent data races when initializing the workers PRNG seeds

Maxim Onciul requested to merge prevent_seed_data_race into master

Each worker currently calls uniformIntDistribution(randomEngine) which modifies the randomEngine internally and thus produces data races when the threads run in parallel.

This change calls uniformIntDistribution(randomEngine) on the main thread for each worker and passes the resulting seeds to the workerLoop.

The data race was found by gcc's and clang's tsan.

Edited by Maxim Onciul

Merge request reports

Loading