MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / queue_get_stoppable

Method queue_get_stoppable

tensorpack/utils/concurrency.py:63–69  ·  view source on GitHub ↗

Take obj from queue, but will give up when the thread is stopped

(self, q)

Source from the content-addressed store, hash-verified

61 pass
62
63 def queue_get_stoppable(self, q):
64 """ Take obj from queue, but will give up when the thread is stopped"""
65 while not self.stopped():
66 try:
67 return q.get(timeout=5)
68 except queue.Empty:
69 pass
70
71
72class LoopThread(StoppableThread):

Callers 1

runMethod · 0.80

Calls 2

stoppedMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected