+ with self.lk:
+ if self.max is not None:
+ if self.timeout is not None:
+ now = start = time.time()
+ while len(self.current) >= self.max:
+ self.tcond.wait(start + self.timeout - now)
+ now = time.time()
+ if now - start > self.timeout:
+ os.abort()
+ else:
+ while len(self.current) >= self.max:
+ self.tcond.wait()
+ th = reqthread(target=self.run, args=[req])
+ th.start()
+ while th.is_alive() and th not in self.current:
+ self.tcond.wait()