def join(self):
self.all_tasks_done.acquire()<EOL>try:<EOL><INDENT>while self.unfinished_tasks:<EOL><INDENT>self.all_tasks_done.wait()<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>self.all_tasks_done.release()<EOL><DEDENT>
Blocks until all items in the Queue have been gotten and processed.

        The count of unfinished tasks goes up whenever an item is added to the
        queue. The count goes down whenever a consumer thread calls task_done()
        to indicate the item was retrieved and all work on it is complete.

        When the count of unfinished tasks drops to zero, join() unblocks.