Nick Coghlan <ncogh...@gmail.com> added the comment: The function below is the workaround I plan to use based on the undocumented-but-public Thread attributes that relate to the task queue (it's essentially just a combination of Queue.join() with the existing structure of the Queue.get() implementation):
def join_queue(q, timeout=None): q.all_tasks_done.acquire() try: if timeout is None: while q.unfinished_tasks: self.all_tasks_done.wait() elif timeout < 0: raise ValueError("'timeout' must be a positive number") else: endtime = _time() + timeout while q.unfinished_tasks: remaining = endtime - _time() if remaining <= 0.0: raise Pending self.all_tasks_done.wait(remaining) finally: q.all_tasks_done.release() ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9634> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com