Message175972
| Author |
sbt |
| Recipients |
christian.heimes, gregory.p.smith, sbt, twouters |
| Date |
2012年11月19日.22:43:46 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1353365030.15.0.682380769379.issue16500@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Note that Gregory P. Smith has written
http://code.google.com/p/python-atfork/
I also started a pure python patch but did not get round it posting it. (It also implements the fork lock idea.) I'll attach it here.
How do you intend to handle the propagation of exceptions? I decided that after
atfork.atfork(prepare1, parent1, child1)
atfork.atfork(prepare2, parent2, child2)
...
atfork.atfork(prepareN, parentN, childN)
calling "pid = os.fork()" should be equivalent to
pid = None
prepareN()
try:
...
prepare2()
try:
prepare1()
try:
pid = posix.fork()
finally:
parent1() if pid != 0 else child1()
finally:
parent2() if pid != 0 else child2()
...
finally:
parentN() if pid != 0 else childN() |
|