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

Function main

recipes/Python/475217_Bounded_Buffer_Example_2/recipe-475217.py:25–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23################################################################################
24
25def main():
26 parse_argv()
27 run_flag, buffer_queue, producer_stack, consumer_stack, print_queue = [True], Queue(argv[1]), Stack(), Stack(), Queue()
28 producer_thread = Thread(target=producer, args=(run_flag, argv[3], buffer_queue, producer_stack, print_queue))
29 consumer_thread = Thread(target=consumer, args=(run_flag, producer_thread, buffer_queue, consumer_stack, argv[4], print_queue))
30 printer_thread = Thread(target=printer, args=(run_flag, consumer_thread, print_queue))
31 producer_thread.start()
32 consumer_thread.start()
33 printer_thread.start()
34 sleep(argv[2])
35 run_flag[0] = False
36 printer_thread.join()
37 check_results(producer_stack , consumer_stack)
38
39def parse_argv():
40 try:

Callers 1

recipe-475217.pyFile · 0.70

Calls 8

sleepFunction · 0.85
check_resultsFunction · 0.85
parse_argvFunction · 0.70
StackClass · 0.70
QueueClass · 0.50
ThreadClass · 0.50
startMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected