t = threading.Thread(target=self.code)
completed = False
self.msg = 'Timed out after %s seconds' % (self.timeout)
Wednesday, May 18, 2005
timeout with threading
I'd gotten the impression that python's threading module was a very frightening thing, and had put off getting to know it. That's too bad, because when I finally looked at it, it provided a very simple way to add timeouts to some of my code. And - unlike os.fork(), etc. - it works on Windows!