[Python-ideas] Thread exceptions and interruption

Guido van Rossum guido at python.org
Wed Sep 19 19:16:06 CEST 2007


On 9/19/07, Adam Olsen <rhamph at gmail.com> wrote:
> Let's try a simpler example, without the main thread (which isn't
> special for exception purposes):
> (Make sure to look at it with a monospace font)
>
>            / baz
> foo - bar +- baz
>            \ baz
>
> bar encapsulates several threads.  It makes no sense unravel the call
> tree while a lower portion of it still exists, so it must wait.  If
> there is a failure, bar will politely tell all 3 baz functions to
> exit, but they probably won't listen (unless they're calling I/O).  If
> necessary bar will wait forever.
>
> foo never sees any of this.  It is completely hidden within bar.

So what happens if the first baz thread raises an exception that bar
isn't handling? I suppose it first waits until all baz threads are
done, but then the question is still open. Does it percolate up to
foo? What if two or more baz threads raise exceptions? How does foo
see these?

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-ideas mailing list