Re: [Python-Dev] [Python-checkins] cpython: Remove outdated statements about threading and imports.
I know you fixed the deadlock problem, but the warnings about shutdown
misbehaviour are still valid.
--
Sent from my phone, thus the relative brevity :)
On May 18, 2012 9:59 PM, "antoine.pitrou"
http://hg.python.org/cpython/rev/565734c9b66d changeset: 77020:565734c9b66d parent: 77018:364289cc7891 user: Antoine Pitrou
date: Fri May 18 13:57:04 2012 +0200 summary: Remove outdated statements about threading and imports. files: Doc/library/multiprocessing.rst | 4 +-- Doc/library/threading.rst | 23 --------------------- 2 files changed, 1 insertions(+), 26 deletions(-)
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -120,9 +120,7 @@ print(q.get()) # prints "[42, None, 'hello']" p.join()
- Queues are thread and process safe, but note that they must never - be instantiated as a side effect of importing a module: this can lead - to a deadlock! (see :ref:`threaded-imports`) + Queues are thread and process safe.
**Pipes**
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -996,27 +996,3 @@ Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:`Semaphore`, and :class:`BoundedSemaphore` objects may be used as :keyword:`with` statement context managers. - - -.. _threaded-imports: - -Importing in threaded code --------------------------- - -While the import machinery is thread-safe, there are two key restrictions on -threaded imports due to inherent limitations in the way that thread-safety is -provided: - -* Firstly, other than in the main module, an import should not have the - side effect of spawning a new thread and then waiting for that thread in - any way. Failing to abide by this restriction can lead to a deadlock if - the spawned thread directly or indirectly attempts to import a module. -* Secondly, all import attempts must be completed before the interpreter - starts shutting itself down. This can be most easily achieved by only - performing imports from non-daemon threads created through the threading - module. Daemon threads and threads created directly with the thread - module will require some other form of synchronization to ensure they do - not attempt imports after system shutdown has commenced. Failure to - abide by this restriction will lead to intermittent exceptions and - crashes during interpreter shutdown (as the late imports attempt to - access machinery which is no longer in a valid state).
-- Repository URL: http://hg.python.org/cpython
_______________________________________________ Python-checkins mailing list Python-checkins@python.org http://mail.python.org/mailman/listinfo/python-checkins
On Fri, 18 May 2012 23:16:09 +1000
Nick Coghlan
I know you fixed the deadlock problem, but the warnings about shutdown misbehaviour are still valid.
Do we have a reproducer? It should have been fixed by http://bugs.python.org/issue1856. Regards Antoine.
On May 18, 2012 11:34 PM, "Antoine Pitrou"
On Fri, 18 May 2012 23:16:09 +1000 Nick Coghlan
wrote: I know you fixed the deadlock problem, but the warnings about shutdown misbehaviour are still valid.
Do we have a reproducer? It should have been fixed by http://bugs.python.org/issue1856.
No, I'd simply missed that change when it was made (or had forgotten about it). Cool. Cheers, Nick. -- Sent from my phone, thus the relative brevity :)
participants (2)
-
Antoine Pitrou
-
Nick Coghlan