# Hacky alternative to using select for timing out players
# WARNING: Do not wrap around HumanPlayer or things breakify
+# WARNING: Do not use in general or things breakify
class Sleeper(multiprocessing.Process):
def __init__(self, timeout):
self.q = q
def run(self):
- #print str(self) + " runs " + str(self.function) + " with args " + str(self.args)
+ #print str(self) + " runs " + str(self.function) + " with args " + str(self.args)
+ #try:
self.q.put(self.function(*self.args))
+ #except IOError:
+ # pass
elif not s.is_alive():
w.terminate()
s.join()
- raise Exception("UNRESPONSIVE")
-
+ raise Exception("TIMEOUT")
+ time.sleep(0.1)