def getMiniThread(self): callers_ts = threadstate.findThreadState() if callers_ts: self.lock.acquire() try: for mini in self.listofminithreads: if mini.threadstate == callers_ts: return mini finally: self.lock.release()
def run(self): print os.getpid() ## startTime = time.time() try: try: self.threadstate = threadstate.findThreadState() self.function(*self.args, **self.kwargs) return except Exception, exception: print exception sys.stdout.flush() finally: self.threadstate.make_defunct()