]> granicus.if.org Git - python/commitdiff
Document import ./. threading issues. #1720705.
authorGeorg Brandl <georg@python.org>
Sat, 23 Feb 2008 23:25:26 +0000 (23:25 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 23 Feb 2008 23:25:26 +0000 (23:25 +0000)
Doc/library/thread.rst
Doc/library/threading.rst

index b0e55ea27577c53e838678a644b930f2c8ec44f9..968ebf13b4261cc1f6d5bfc900c20e7e28f0912d 100644 (file)
@@ -150,6 +150,11 @@ In addition to these methods, lock objects can also be used via the
   exception will be received by an arbitrary thread.  (When the :mod:`signal`
   module is available, interrupts always go to the main thread.)
 
+* The import machinery is not thread safe.  In general, an import may not
+  have the side effect of importing a module, and only the main thread
+  should import modules.  Imports within or caused by a thread other than
+  the main thread isn't safe.
+
 * Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is
   equivalent to calling :func:`exit`.
 
@@ -170,4 +175,3 @@ In addition to these methods, lock objects can also be used via the
 * When the main thread exits, it does not do any of its usual cleanup (except
   that :keyword:`try` ... :keyword:`finally` clauses are honored), and the
   standard I/O files are not flushed.
-
index 077ae0119c29d927134e9b72d34d3353fbf426e0..73ede7b6c56c27eb0bc9148146abef32a65c9309 100644 (file)
@@ -562,6 +562,13 @@ the :meth:`setDaemon` method and retrieved with the :meth:`isDaemon` method.
 There is a "main thread" object; this corresponds to the initial thread of
 control in the Python program.  It is not a daemon thread.
 
+.. warning::
+   
+   The import machinery is not thread safe.  In general, an import may not
+   have the side effect of importing a module, and only the main thread
+   should import modules.  Imports within or caused by a thread other than
+   the main thread isn't safe.
+
 There is the possibility that "dummy thread objects" are created. These are
 thread objects corresponding to "alien threads", which are threads of control
 started outside the threading module, such as directly from C code.  Dummy