Indicate that a formerly enqueued task is complete. Used by Queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete. If a join() is currently blocking, it will resume
(self)
| 70 | self.is_shutdown = False |
| 71 | |
| 72 | def task_done(self): |
| 73 | '''Indicate that a formerly enqueued task is complete. |
| 74 | |
| 75 | Used by Queue consumer threads. For each get() used to fetch a task, |
| 76 | a subsequent call to task_done() tells the queue that the processing |
| 77 | on the task is complete. |
| 78 | |
| 79 | If a join() is currently blocking, it will resume when all items |
| 80 | have been processed (meaning that a task_done() call was received |
| 81 | for every item that had been put() into the queue). |
| 82 | |
| 83 | Raises a ValueError if called more times than there were items |
| 84 | placed in the queue. |
| 85 | ''' |
| 86 | with self.all_tasks_done: |
| 87 | unfinished = self.unfinished_tasks - 1 |
| 88 | if unfinished <= 0: |
| 89 | if unfinished < 0: |
| 90 | raise ValueError('task_done() called too many times') |
| 91 | self.all_tasks_done.notify_all() |
| 92 | self.unfinished_tasks = unfinished |
| 93 | |
| 94 | def join(self): |
| 95 | '''Blocks until all items in the Queue have been gotten and processed. |
nothing calls this directly
no test coverage detected