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 r
(self)
| 55 | self.unfinished_tasks = 0 |
| 56 | |
| 57 | def task_done(self): |
| 58 | '''Indicate that a formerly enqueued task is complete. |
| 59 | |
| 60 | Used by Queue consumer threads. For each get() used to fetch a task, |
| 61 | a subsequent call to task_done() tells the queue that the processing |
| 62 | on the task is complete. |
| 63 | |
| 64 | If a join() is currently blocking, it will resume when all items |
| 65 | have been processed (meaning that a task_done() call was received |
| 66 | for every item that had been put() into the queue). |
| 67 | |
| 68 | Raises a ValueError if called more times than there were items |
| 69 | placed in the queue. |
| 70 | ''' |
| 71 | with self.all_tasks_done: |
| 72 | unfinished = self.unfinished_tasks - 1 |
| 73 | if unfinished <= 0: |
| 74 | if unfinished < 0: |
| 75 | raise ValueError('task_done() called too many times') |
| 76 | self.all_tasks_done.notify_all() |
| 77 | self.unfinished_tasks = unfinished |
| 78 | |
| 79 | def join(self): |
| 80 | '''Blocks until all items in the Queue have been gotten and processed. |
nothing calls this directly
no test coverage detected