diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-08-30 05:16:13 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-08-30 05:16:13 (GMT) |
commit | 692323488baf518117d3ede90189812723f39948 (patch) | |
tree | 8401474367a2c7684060b891da495cfb025e9bd5 /Doc/lib/libimp.tex | |
parent | c41418751fcef0a42f336ba91871827b45d558a7 (diff) | |
download | cpython-692323488baf518117d3ede90189812723f39948.zip cpython-692323488baf518117d3ede90189812723f39948.tar.gz cpython-692323488baf518117d3ede90189812723f39948.tar.bz2 |
Add a new function imp.lock_held(), and use it to skip test_threaded_import
when that test is doomed to deadlock.
Diffstat (limited to 'Doc/lib/libimp.tex')
-rw-r--r-- | Doc/lib/libimp.tex | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/lib/libimp.tex b/Doc/lib/libimp.tex index 23391ff..a96839f 100644 --- a/Doc/lib/libimp.tex +++ b/Doc/lib/libimp.tex @@ -93,6 +93,19 @@ Return a new empty module object called \var{name}. This object is \emph{not} inserted in \code{sys.modules}. \end{funcdesc} +\begin{funcdesc}{lock_held}{} +Return 1 if the import lock is currently held, else 0. +On platforms without threads, always return 0. + +On platforms with threads, a thread executing an import holds an internal +lock until the import is complete. +This lock blocks other threads from doing an import until the original +import completes, which in turn prevents other threads from seeing +incomplete module objects constructed by the original thread while in +the process of completing its import (and the imports, if any, +triggered by that). +\end{funcdesc} + The following constants with integer values, defined in this module, are used to indicate the search result of \function{find_module()}. |