cpython/Doc/c-api
Thomas Wouters c4dcb3801e 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.
2009-09-16 19:55:54 +00:00
..
abstract.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
allocation.rst Issue #4129: Documentation notes for int -> Py_ssize_t changes. 2009-04-25 19:46:19 +00:00
arg.rst Fix arg types of et#. 2009-07-24 16:28:38 +00:00
bool.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
buffer.rst #6821: fix signature of PyBuffer_Release(). 2009-09-02 20:37:16 +00:00
bytearray.rst fix grammar 2008-05-30 20:44:39 +00:00
cell.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
class.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
cobject.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
code.rst PyCode_NewEmpty: 2009-05-08 21:51:06 +00:00
complex.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
concrete.rst PyCode_NewEmpty: 2009-05-08 21:51:06 +00:00
conversion.rst Issue #5920: Changed format.__float__ and complex.__float__ to use a precision of 12 when using the empty presentation type. This more closely matches str()'s behavior and reduces surprises when adding alignment flags to an empty format string. Patch by Mark Dickinson. 2009-05-05 18:26:08 +00:00
datetime.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
descriptor.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
dict.rst Issue #4129: Belatedly document which C API functions had their argument(s) or 2009-04-25 17:59:03 +00:00
exceptions.rst PyErr_PrintEx is also in 2.x... 2009-02-05 11:23:47 +00:00
file.rst Fix uses of the default role. 2009-01-03 20:47:01 +00:00
float.rst Dont put "void" in signature for nullary functions. 2009-07-24 16:46:38 +00:00
function.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
gcsupport.rst Issue #4129: More documentation pointers about int -> Py_ssize_t. 2009-04-25 19:44:55 +00:00
gen.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
import.rst builtin -> built-in. 2009-07-26 14:37:28 +00:00
index.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
init.rst Fix issue #1590864, multiple threads and fork() can cause deadlocks, by 2009-09-16 19:55:54 +00:00
int.rst Dont put "void" in signature for nullary functions. 2009-07-24 16:46:38 +00:00
intro.rst Demote warnings to notices where appropriate, following the goal that as few "red box" warnings 2009-04-27 15:29:09 +00:00
iter.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
iterator.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
list.rst #5967: note that the C slicing APIs do not support negative indices. 2009-06-04 10:15:57 +00:00
long.rst Issue #4129: Belatedly document which C API functions had their argument(s) or 2009-04-25 17:59:03 +00:00
mapping.rst Issue #4129: Belatedly document which C API functions had their argument(s) or 2009-04-25 17:59:03 +00:00
marshal.rst Issue #4129: int -> Py_ssize_t documentation. 2009-04-25 20:41:40 +00:00
memory.rst Issue #2620: Overflow checking when allocating or reallocating memory 2008-07-22 04:46:32 +00:00
method.rst Dont put "void" in signature for nullary functions. 2009-07-24 16:46:38 +00:00
module.rst Remove trailing whitespace. 2009-01-03 20:55:06 +00:00
none.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
number.rst Fix 'the the'; grammar fix 2009-04-03 21:44:49 +00:00
objbuffer.rst Issue #4129: int -> Py_ssize_t documentation. 2009-04-25 20:44:58 +00:00
object.rst Issue #4129: Belatedly document which C API functions had their argument(s) or 2009-04-25 17:59:03 +00:00
objimpl.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00
refcounting.rst Fix markup. 2007-12-05 19:49:21 +00:00
reflection.rst Issue 5954, PyFrame_GetLineNumber: 2009-05-08 22:23:21 +00:00
sequence.rst Fix some more small markup problems. 2009-05-30 10:33:23 +00:00
set.rst Issue #4129: Belatedly document which C API functions had their argument(s) or 2009-04-25 17:59:03 +00:00
slice.rst Issue #4129: Document more int -> Py_ssize_t changes. 2009-04-25 18:46:03 +00:00
string.rst Issue #4129: more int -> Py_ssize_t documentation. 2009-04-25 20:55:39 +00:00
structures.rst First attempt to document PyObject_HEAD_INIT and PyVarObject_HEAD_INIT. 2009-04-25 11:59:09 +00:00
sys.rst Dont put "void" in signature for nullary functions. 2009-07-24 16:46:38 +00:00
tuple.rst Dont put "void" in signature for nullary functions. 2009-07-24 16:46:38 +00:00
type.rst Dont put "void" in signature for nullary functions. 2009-07-24 16:46:38 +00:00
typeobj.rst #6336: Add nb_divide. 2009-07-29 16:32:30 +00:00
unicode.rst builtin -> built-in. 2009-07-26 14:37:28 +00:00
utilities.rst Missed one big file to split up. 2008-01-19 22:14:27 +00:00
veryhigh.rst #5227: note that Py_Main doesnt return on SystemExit. 2009-03-31 18:33:10 +00:00
weakref.rst Split the monstrous C API manual files in smaller parts. 2008-01-19 22:08:21 +00:00