3 ms·
You could also invalidate all locks from the parent with some kind of generational scheme based on pid or whatever. I believe the Python interpreters do someth
by loeg 10y ago
You could also invalidate all locks from the parent with some kind of generational scheme based on pid or whatever. I believe the Python interpreters do something crazy like this to try and avoid deadlock after forking multithreaded programs.
- quotemstr 10y agoSo what? Under that scheme, you can take the locks, but the lock-protected data structures are probably garbage. (That is, the locks become implicitly "abandoned", not "unlocked".)
- loeg 10y agoI'm not defending it as a model. I think python's approach to fork & thread interaction, which is to punt on it completely while exposing both to end users, is pretty broken.