4 ms·
If you have enough discipline to make sure you only create threads after all the forking is done, then sure. But having such discipline is harder than just forb
by kccqzy 8mo ago
If you have enough discipline to make sure you only create threads after all the forking is done, then sure. But having such discipline is harder than just forbidding fork or forbidding threads in your program. It turns a careful analysis of timing and causality into just banning a few functions.
- josefx 8mo agoCan't you check what threads are active at the time you fork?
- kccqzy 8mo agoAnd what do you do with that information? Refuse to fork after you detect more than one thread running? I haven’t seen any code that gracefully handles the unable-to-fork scenario. When people write fork-based code, especially in Python, they always expect forking to succeed.