blob: e20abc32576e542205c2ee93d0375785c05b79d3 [file] [log] [blame]
kelvin-onlab54400a92015-02-26 18:05:51 -08001#!/usr/bin/env python
2import threading
3
4class Thread(threading.Thread):
5 def __init__(self, target = None, threadID=None, name="", args=(), kwargs={}):
6 super(Thread, self).__init__()
7 self.threadID = threadID
8 self.name = name
9 self.target = target
10 self.args = args
11 self.kwargs = kwargs
12 self.result = None
13
14 def run( self ):
15 try:
16 if self.target is not None:
17 if len(self.args) != 0:
18 self.result = self.target( *self.args )
19 else:
20 self.result = self.target()
21 except Exception as e:
22 print "Thread-" + str(self.threadID) + \
23 ":something went wrong with " + self.name + " method"
24 print e