Howto pass exceptions between threads
Alexander Eisenhuth
newsuser at stacom-software.de
Tue Mar 6 03:17:17 EST 2007
John Nagle schrieb:
> Alexander Eisenhuth wrote:
>> Hallo Alltogether,
>>
>> I've searched in this mailing list, but it seems to me that there is
>> no general approach to pass exceptions from one thread to another.
>
> Very few languages have that.
>
> Actually, it could be made to work for Python, but it would have to
> be carefully designed. Something that raises an exception in another
> thread the next time the thread blocks would have relatively sane
> semantics. You couldn't raise an exception on a compute-bound thread,
> only at block points (locks, I/O, long system calls.)
>
> John Nagle
Yes you're right, it must be well designed with a clear responsibility
delegation. I can imgagine the following points:
- Thread termination with termination handler (for Thread instance)
- Main Thread information / synchronisation
- Default/Customized main thread exception handler
More information about the Python-list
mailing list