예제 #1
0
파일: pool.py 프로젝트: dsuch/gevent
 def kill(self, exception=GreenletExit, block=True, timeout=None):
     """
     Kill all greenlets being tracked by this group.
     """
     timer = Timeout._start_new_or_dummy(timeout)
     try:
         try:
             while self.greenlets:
                 for greenlet in list(self.greenlets):
                     if greenlet not in self.dying:
                         try:
                             kill = greenlet.kill
                         except AttributeError:
                             _kill(greenlet, exception)
                         else:
                             kill(exception, block=False)
                         self.dying.add(greenlet)
                 if not block:
                     break
                 joinall(self.greenlets)
         except Timeout as ex:
             if ex is not timer:
                 raise
     finally:
         timer.cancel()
예제 #2
0
 def kill(self, exception=GreenletExit, block=True, timeout=None):
     """
     Kill all greenlets being tracked by this group.
     """
     timer = Timeout._start_new_or_dummy(timeout)
     try:
         while self.greenlets:
             for greenlet in list(self.greenlets):
                 if greenlet in self.dying:
                     continue
                 try:
                     kill = greenlet.kill
                 except AttributeError:
                     _kill(greenlet, exception)
                 else:
                     kill(exception, block=False)
                 self.dying.add(greenlet)
             if not block:
                 break
             joinall(self.greenlets)
     except Timeout as ex:
         if ex is not timer:
             raise
     finally:
         timer.cancel()
예제 #3
0
파일: pool.py 프로젝트: snaury/gevent
 def kill(self, exception=GreenletExit, block=True, timeout=None):
     timer = Timeout.start_new(timeout)
     try:
         try:
             while self.greenlets:
                 for greenlet in list(self.greenlets):
                     if greenlet not in self.dying:
                         try:
                             kill = greenlet.kill
                         except AttributeError:
                             _kill(greenlet, exception)
                         else:
                             kill(exception, block=False)
                         self.dying.add(greenlet)
                 if not block:
                     break
                 joinall(self.greenlets)
         except Timeout as ex:
             if ex is not timer:
                 raise
     finally:
         timer.cancel()
 def kill(self, exception=GreenletExit, block=True, timeout=None):
     timer = Timeout.start_new(timeout)
     try:
         try:
             while self.greenlets:
                 for greenlet in list(self.greenlets):
                     if greenlet not in self.dying:
                         try:
                             kill = greenlet.kill
                         except AttributeError:
                             _kill(greenlet, exception)
                         else:
                             kill(exception, block=False)
                         self.dying.add(greenlet)
                 if not block:
                     break
                 joinall(self.greenlets)
         except Timeout:
             ex = sys.exc_info()[1]
             if ex is not timer:
                 raise
     finally:
         timer.cancel()