summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-02-15 21:01:17 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-02-15 21:01:17 (GMT)
commitd3f4a1a00a0c40a57a0a6054dd822271d114c557 (patch)
treeb14583c58d4f47108816e7b45bb176eaf7e8d2b1
parent7db04e7c4802022cfb3a1daacab333cd9efd5a78 (diff)
downloadcpython-d3f4a1a00a0c40a57a0a6054dd822271d114c557.zip
cpython-d3f4a1a00a0c40a57a0a6054dd822271d114c557.tar.gz
cpython-d3f4a1a00a0c40a57a0a6054dd822271d114c557.tar.bz2
Patch #893566: Document that tp_dealloc may be called from any thread.
-rw-r--r--Doc/api/newtypes.tex10
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/api/newtypes.tex b/Doc/api/newtypes.tex
index 038cce9..5b2e6cf 100644
--- a/Doc/api/newtypes.tex
+++ b/Doc/api/newtypes.tex
@@ -1389,6 +1389,16 @@ inherited by subtypes.
field.
\end{cmemberdesc}
+Also, note that, in a garbage collected Python, tp_dealloc may be
+called from any Python thread, not just the thread which created the
+object (if the object becomes part of a refcount cycle, that cycle
+might be collected by a garbage collection on any thread). This is
+not a problem for Python API calls, since the thread on which
+tp_dealloc is called will own the Global Interpreter Lock (GIL).
+However, if the object being destroyed in turn destroys objects from
+some other C or C++ library, care should be taken to ensure that
+destroying those objects on the thread which called tp_dealloc will
+not violate any assumptions of the library.
\section{Mapping Object Structures \label{mapping-structs}}