mirror of https://github.com/python/cpython
448db2155f
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74841 | thomas.wouters | 2009-09-16 12:55:54 -0700 (Wed, 16 Sep 2009) | 23 lines Fix issue #1590864, multiple threads and fork() can cause deadlocks, by acquiring the import lock around fork() calls. This prevents other threads from having that lock while the fork happens, and is the recommended way of dealing with such issues. There are two other locks we care about, the GIL and the Thread Local Storage lock. The GIL is obviously held when calling Python functions like os.fork(), and the TLS lock is explicitly reallocated instead, while also deleting now-orphaned TLS data. This only fixes calls to os.fork(), not extension modules or embedding programs calling C's fork() directly. Solving that requires a new set of API functions, and possibly a rewrite of the Python/thread_*.c mess. Add a warning explaining the problem to the documentation in the mean time. This also changes behaviour a little on AIX. Before, AIX (but only AIX) was getting the import lock reallocated, seemingly to avoid this very same problem. This is not the right approach, because the import lock is a re-entrant one, and reallocating would do the wrong thing when forking while holding the import lock. Will backport to 2.6, minus the tiny AIX behaviour change. ........ |
||
---|---|---|
.. | ||
Python-ast.c | ||
_warnings.c | ||
asdl.c | ||
ast.c | ||
atof.c | ||
bltinmodule.c | ||
ceval.c | ||
codecs.c | ||
compile.c | ||
dup2.c | ||
dynload_aix.c | ||
dynload_atheos.c | ||
dynload_beos.c | ||
dynload_dl.c | ||
dynload_hpux.c | ||
dynload_next.c | ||
dynload_os2.c | ||
dynload_shlib.c | ||
dynload_stub.c | ||
dynload_win.c | ||
errors.c | ||
formatter_string.c | ||
formatter_unicode.c | ||
frozen.c | ||
frozenmain.c | ||
future.c | ||
getargs.c | ||
getcompiler.c | ||
getcopyright.c | ||
getcwd.c | ||
getmtime.c | ||
getopt.c | ||
getplatform.c | ||
getversion.c | ||
graminit.c | ||
import.c | ||
importdl.c | ||
importdl.h | ||
mactoolboxglue.c | ||
marshal.c | ||
modsupport.c | ||
mysnprintf.c | ||
mystrtoul.c | ||
peephole.c | ||
pyarena.c | ||
pyfpe.c | ||
pymath.c | ||
pystate.c | ||
pystrcmp.c | ||
pystrtod.c | ||
pythonrun.c | ||
sigcheck.c | ||
strdup.c | ||
strtod.c | ||
structmember.c | ||
symtable.c | ||
sysmodule.c | ||
thread.c | ||
thread_atheos.h | ||
thread_beos.h | ||
thread_cthread.h | ||
thread_foobar.h | ||
thread_lwp.h | ||
thread_nt.h | ||
thread_os2.h | ||
thread_pth.h | ||
thread_pthread.h | ||
thread_sgi.h | ||
thread_solaris.h | ||
thread_wince.h | ||
traceback.c |