3 ms·
I'm trying to figure out how you switch "into" thread-local prng mode after a call to srand. Case 1: T1: srand(); rng(); rng() T2: no calls to rng Case 2: T1:
by yuliyp 2y ago
I'm trying to figure out how you switch "into" thread-local prng mode after a call to srand.
Case 1:
T1: srand(); rng(); rng()
T2: no calls to rng
Case 2:
T1: srand();
T2: (spawns after the srand call) rng(); rng()
How would T2 know that it should produce the seeded sequence as opposed to one based on its own prng?
- vlovich123 2y agosrand sets a TLS flag and the thread spawning code checks that flag on-thread to know how to initialize the off-thread rng).