3 ms·
How about if the fork happens from a signal handler?
by cperciva 9y ago
How about if the fork happens from a signal handler?
- colmmacc 9y agoSee my reply here ... https://news.ycombinator.com/item?id=15761490 https://news.ycombinator.com/item?id=15761490
- tedunangst 9y agoWhy does that matter? The parent will eventually return from the signal handler and resume execution. What does fork have to do with anything? arc4random (or whatever you want to call it) isn't marked signal safe.
- cperciva 9y agoThe child will also eventually return from the signal handler and resume execution. In the middle of the PRNG, thus returning the same random numbers in both processes. I'm not sure what you mean by "arc4random isn't marked signal safe" -- you mean it can't be used in any process which receives signals?