self._q.put((ThreadFunction._CALL, arg))
def stop(self):
+ # empty the queue
+ try:
+ while True:
+ self._q.get_nowait()
+ except queue.Empty:
+ pass
+ # now wait till the job-in-progress is done
self._q.put((ThreadFunction._TERM, None))
self._t.join()