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

Function consume

recipes/Python/475216_Bounded_Buffer_Example_1/recipe-475216.py:73–84  ·  view source on GitHub ↗
(run_flag, queue, recv, producer)

Source from the content-addressed store, hash-verified

71
72# called by the consumer thread
73def consume(run_flag, queue, recv, producer):
74 # consume items while running
75 while run_flag[0]:
76 do_consume(queue, recv)
77 # empty the queue to allow maximum room
78 while not queue.empty():
79 do_consume(queue, recv)
80 # wait for the producer to end
81 producer.join()
82 # consume any other items that might have been produced
83 while not queue.empty():
84 do_consume(queue, recv)
85
86# executes one consumption operation
87def do_consume(queue, recv):

Callers

nothing calls this directly

Calls 3

do_consumeFunction · 0.85
emptyMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected