Reputation: 631
I have some code running in a thread that I need to respond to any exceptions within the calling thread. How would I find out if there are any exceptions and just reboot the child thread?
Upvotes: 2
Views: 204
Reputation: 2284
you can get exception with sth like this:
def run(self):
while True:
try: #yourThread
except Exception, e: print e
and for restarting a child check out this answer here.
Upvotes: 2
Reputation: 11614
You would have to terminate/join the child-process in the try/except/finaly
-block of the parent thread and afterwards reinvoke it.
Link to an older SO-post, which discusses the "killing" of a thread.
Upvotes: 3