[Python-3000] threading, part 2 (original) (raw)
Guido van Rossum guido at python.org
Wed Aug 16 02:28:21 CEST 2006
- Previous message: [Python-3000] threading, part 2
- Next message: [Python-3000] threading, part 2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 8/11/06, Jason Orendorff <jason.orendorff at gmail.com> wrote:
On 8/11/06, Josiah Carlson <jcarlson at uci.edu> wrote: > Slawomir Nowaczyk <slawomir.nowaczyk.847 at student.lu.se> wrote: > > But it should not be done lightly and never when the code is not > > specifically expecting it. > > If you don't want random exceptions being raised in your threads, then > don't use this method that is capable of raising exceptions somewhat > randomly.
I agree. The only question is how dire the warnings should be. I'll answer that question with another question: Are we going to make the standard library robust against asynchronous exceptions? For _example, class Thread has an attribute stopped that is set using code similar to the example code I posted. An exception at just the _wrong time would kill the thread while leaving stopped == False. Maybe that particular case is worth fixing, but to find and fix them all? Better to put strong warnings on this one method: may cause unpredictable brokenness.
That is a rather special case since this code (unlike most stdlib code) can assume it won't get asynchronous exceptions like KeyboardInterrupt, since that can't be raised in threads.
I expect that the unpredictable brokenness is even bigger in most user code -- most people can't write threadsafe code if their life depended on it. I believe the only exception I know is Tim Peters.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-3000] threading, part 2
- Next message: [Python-3000] threading, part 2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]