[Patches] [Patch #101226] make threading fork-safe
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 24 Aug 2000 11:19:17 -0700
Patch #101226 has been updated.
Project:
Category: core (C code)
Status: Accepted
Summary: make threading fork-safe
Follow-Ups:
Date: 2000-Aug-19 00:46
By: cgw
Comment:
See http://www.lambdacs.com/newsgroup/FAQ.html#Q120
and "man pthread_atfork" for background.
I don't use a pthread_atfork handler here - the explicit
approach is more portable. However calling fork() from
C extensions could still cause trouble.
This patch causes the child to create a new interpreter
lock after doing a fork. It would be nice to deallocate
the old lock with PyThread_free_lock, but this does some
unwanted error-checking in addition to deallocating the
lock. So I waste a little memory instead. To really do
this cleanly one could add a new PyThread_reset_lock function to all the thread_*.h files, and use that instead.
-------------------------------------------------------
Date: 2000-Aug-19 21:51
By: tim_one
Comment:
Assigned to me. I'll discuss it with Guido too. So far 2e've gotten 3 reports from people who don't see failures in assorted test cases anymore, and no reports of remaining failures.
-------------------------------------------------------
Date: 2000-Aug-24 14:02
By: tim_one
Comment:
Accepted, and assigned to Jeremy for checkin.
We may (or may not) want to bulletproof more locks for 2.0b1, but this has certainly helped so far and done no harm. Jeremy, I don't feel comfortable trying to check in the change myself, as I can't run test_fork1 (or any other fork test) on Windows.
-------------------------------------------------------
Date: 2000-Aug-24 14:19
By: tim_one
Comment:
Accepted, and assigned to Jeremy for checkin.
We may (or may not) want to bulletproof more locks for 2.0b1, but this has certainly helped so far and done no harm. Jeremy, I don't feel comfortable trying to check in the change myself, as I can't run test_fork1 (or any other fork test) on Windows.
-------------------------------------------------------
-------------------------------------------------------
For more info, visit:
http://sourceforge.net/patch/?func=detailpatch&patch_id=101226&group_id=5470