def handle(self, request):
raise Exception()
def ckflush(self, req):
+ p = select.poll()
+ p.register(req, select.POLLOUT)
while len(req.buffer) > 0:
- rls, wls, els = select.select([], [req], [req])
+ p.poll()
req.flush()
def close(self):
pass
while len(self.current) >= self.max:
self.tcond.wait()
th = reqthread(target=self.run, args=[req])
+ th.registered = False
th.start()
- while th.is_alive() and th not in self.current:
+ while not th.registered:
self.tcond.wait()
def run(self, req):
th = threading.current_thread()
with self.lk:
self.current.add(th)
+ th.registered = True
self.tcond.notify_all()
try:
env = req.mkenv()
while len(self.current) >= self.max:
self.tcond.wait()
th = reqthread(target=self.handle1, args=[req])
+ th.registered = False
th.start()
- while th.is_alive() and th not in self.current:
+ while not th.registered:
self.tcond.wait()
def handle1(self, req):
th = threading.current_thread()
with self.lk:
self.current.add(th)
+ th.registered = True
self.tcond.notify_all()
try:
env = req.mkenv()