X-Git-Url: http://www.dolda2000.com/gitweb/?a=blobdiff_plain;f=python%2Fashd%2Fserve.py;h=e9f92b0467cf1e44ed635316e94bff793270dc05;hb=76ff6c4dcf0bed028475ef646f4d637d8e91d1a7;hp=0197d47daf08f3d469b3b450a91641aadc094248;hpb=8f410ce7bbc467c7c40c92df6b5f22e8a9ee1de8;p=ashd.git diff --git a/python/ashd/serve.py b/python/ashd/serve.py index 0197d47..e9f92b0 100644 --- a/python/ashd/serve.py +++ b/python/ashd/serve.py @@ -142,8 +142,9 @@ class freethread(handler): 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): @@ -151,6 +152,7 @@ class freethread(handler): th = threading.current_thread() with self.lk: self.current.add(th) + th.registered = True self.tcond.notify_all() try: env = req.mkenv() @@ -212,8 +214,9 @@ class resplex(handler): 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): @@ -221,6 +224,7 @@ class resplex(handler): th = threading.current_thread() with self.lk: self.current.add(th) + th.registered = True self.tcond.notify_all() try: env = req.mkenv()