git.ucc.asn.au
/
progcomp2013.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Got cgi script to work
[progcomp2013.git]
/
qchess
/
src
/
timeout_player.py
diff --git
a/qchess/src/timeout_player.py
b/qchess/src/timeout_player.py
index
36f9e20
..
1bd53c9
100644
(file)
--- a/
qchess/src/timeout_player.py
+++ b/
qchess/src/timeout_player.py
@@
-3,6
+3,7
@@
import multiprocessing
# Hacky alternative to using select for timing out players
# WARNING: Do not wrap around HumanPlayer or things breakify
# 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):
class Sleeper(multiprocessing.Process):
def __init__(self, timeout):
@@
-21,8
+22,11
@@
class Worker(multiprocessing.Process):
self.q = q
def run(self):
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))
self.q.put(self.function(*self.args))
+ #except IOError:
+ # pass
@@
-42,8
+46,8
@@
def TimeoutFunction(function, args, timeout):
elif not s.is_alive():
w.terminate()
s.join()
elif not s.is_alive():
w.terminate()
s.join()
- raise Exception("
UNRESPONSIVE
")
-
+ raise Exception("
TIMEOUT
")
+ time.sleep(0.1)
UCC
git Repository :: git.ucc.asn.au