473,386 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Howto pass exceptions between threads

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.

I think most application do a unique way of handling "unhandled exceptions", at
least they (should) try to log them.

The following discussion seems to me most valuable (Sorry for the long URL, I
don't know a way of shorter)

http://groups.google.de/group/comp.l...820c20ff3fcea8
http://groups.google.de/group/comp.l...8a8d9e85883fe3

I've the feeling that if you're using the python class threading.Thread you've a
unique interface of handling it. (thread synchronizing + exception raising)

But' when you've a C++ extension, that uses it's own thread implementation and
your exceptions happens in python code (but from a thread that is controlled by
your extension) you have another problem.

Maybe I've overseen something in the python docu, so I ask for the solutions,
concepts, hints ... you solved the problem.

Regards
Alexander
Mar 5 '07 #1
2 2094
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
Mar 5 '07 #2
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
Mar 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Roy Smith | last post by:
What is supposed to happen when an exception is raised and not caught in a thread? The Reference Manual (section 4.2) states "When an exception is not handled at all, the interpreter terminates...
33
by: Steven Bethard | last post by:
I feel like this has probably been answered before, but I couldn't find something quite like it in the archives. Feel free to point me somewhere if you know where this has already been answered. ...
8
by: Shane Groff | last post by:
I know this is a recurring discussion (I've spent the last 3 days reading through threads on the topic), but I feel compelled to start it up again. After reading through the existing threads, I...
16
by: Einar Høst | last post by:
Hi, I'm getting into the Trace-functionality in .NET, using it to provide some much-needed logging across dlls in the project we're working on. However, being a newbie, I'm wondering if some...
3
by: Sako | last post by:
I am trying to teach myself perl by writing a program I've been meaning to implement, so I am pretty green in perl. I'm having problems sharing filehandles opened by a thread - been RTFM for a few...
6
by: robert | last post by:
I get python crashes and (in better cases) strange Python exceptions when (in most cases) importing and using cookielib lazy on demand in a thread. It is mainly with cookielib, but remember the...
6
by: Pieter | last post by:
Hi, For some procedures that throws exceptions, I would like to show different messages to the user depending on what type of exception he's getting. For instance this one: when the file is...
2
by: james | last post by:
Hi all, I have a console app that uses AppDomain.CurrentDomain.UnhandledException. However it only seems to catch exceptions in the current thread. Exceptions in other threads (like from a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.