Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 22 lines (18 sloc) 0.628 kB
8d96549 @bitprophet Re #204, first thread exception approach in, another forthcoming
bitprophet authored
1 import threading
2
3
4 class ThreadHandler(object):
5 def __init__(self, name, callable, *args, **kwargs):
6 self.exception = None
7 def wrapper(*args, **kwargs):
8 try:
9 callable(*args, **kwargs)
10 except BaseException, e:
11 self.exception = e
12 thread = threading.Thread(None, wrapper, name, args, kwargs)
13 thread.setDaemon(True)
14 thread.start()
15 self.thread = thread
16
17 def join(self):
18 self.thread.join()
19 if self.exception is not None:
20 print("##### Raising stored exception")
21 raise self.exception
Something went wrong with that request. Please try again.