MCPcopy Create free account
hub / github.com/ActiveState/code / join

Method join

recipes/Python/475160_TaskQueue/recipe-475160.py:40–54  ·  view source on GitHub ↗

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 complet

(self)

Source from the content-addressed store, hash-verified

38 self.all_tasks_done.release()
39
40 def join(self):
41 """Blocks until all items in the Queue have been gotten and processed.
42
43 The count of unfinished tasks goes up whenever an item is added to the
44 queue. The count goes down whenever a consumer thread calls task_done()
45 to indicate the item was retrieved and all work on it is complete.
46
47 When the count of unfinished tasks drops to zero, join() unblocks.
48 """
49 self.all_tasks_done.acquire()
50 try:
51 while self.unfinished_tasks:
52 self.all_tasks_done.wait()
53 finally:
54 self.all_tasks_done.release()
55
56
57#### Example code ####################

Callers 15

compressMethod · 0.45
_parse_arguments2Method · 0.45
_usageMethod · 0.45
mainFunction · 0.45
get_error_tracebackFunction · 0.45
_test2Function · 0.45
splitCountFunction · 0.45
zipwalkFunction · 0.45
print_logMethod · 0.45
write_dbFunction · 0.45
recipe-456361.pyFile · 0.45
format2colsFunction · 0.45

Calls 3

acquireMethod · 0.45
waitMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected