Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
htparser: Added a simple PID-file state monitoring protocol.
[ashd.git]
/
python
/
ashd
/
serve.py
diff --git
a/python/ashd/serve.py
b/python/ashd/serve.py
index
0197d47
..
3de5861
100644
(file)
--- a/
python/ashd/serve.py
+++ b/
python/ashd/serve.py
@@
-75,8
+75,10
@@
class handler(object):
def handle(self, request):
raise Exception()
def ckflush(self, req):
def handle(self, request):
raise Exception()
def ckflush(self, req):
+ p = select.poll()
+ p.register(req, select.POLLOUT)
while len(req.buffer) > 0:
while len(req.buffer) > 0:
-
rls, wls, els = select.select([], [req], [req]
)
+
p.poll(
)
req.flush()
def close(self):
pass
req.flush()
def close(self):
pass
@@
-142,8
+144,9
@@
class freethread(handler):
while len(self.current) >= self.max:
self.tcond.wait()
th = reqthread(target=self.run, args=[req])
while len(self.current) >= self.max:
self.tcond.wait()
th = reqthread(target=self.run, args=[req])
+ th.registered = False
th.start()
th.start()
- while
th.is_alive() and th not in self.current
:
+ while
not th.registered
:
self.tcond.wait()
def run(self, req):
self.tcond.wait()
def run(self, req):
@@
-151,6
+154,7
@@
class freethread(handler):
th = threading.current_thread()
with self.lk:
self.current.add(th)
th = threading.current_thread()
with self.lk:
self.current.add(th)
+ th.registered = True
self.tcond.notify_all()
try:
env = req.mkenv()
self.tcond.notify_all()
try:
env = req.mkenv()
@@
-212,8
+216,9
@@
class resplex(handler):
while len(self.current) >= self.max:
self.tcond.wait()
th = reqthread(target=self.handle1, args=[req])
while len(self.current) >= self.max:
self.tcond.wait()
th = reqthread(target=self.handle1, args=[req])
+ th.registered = False
th.start()
th.start()
- while
th.is_alive() and th not in self.current
:
+ while
not th.registered
:
self.tcond.wait()
def handle1(self, req):
self.tcond.wait()
def handle1(self, req):
@@
-221,6
+226,7
@@
class resplex(handler):
th = threading.current_thread()
with self.lk:
self.current.add(th)
th = threading.current_thread()
with self.lk:
self.current.add(th)
+ th.registered = True
self.tcond.notify_all()
try:
env = req.mkenv()
self.tcond.notify_all()
try:
env = req.mkenv()