()
| 22 | |
| 23 | # provides an outline for the execution of the program |
| 24 | def main(): |
| 25 | # check and parse the command line arguments |
| 26 | parse_sys_argv() |
| 27 | # setup the variables used by the threads |
| 28 | run_flag = [True] |
| 29 | queue = Queue(argv[1]) |
| 30 | send = Stack() |
| 31 | recv = Stack() |
| 32 | # start the threads |
| 33 | producer = Thread(target=produce, args=(run_flag, queue, send)) |
| 34 | consumer = Thread(target=consume, args=(run_flag, queue, recv, producer)) |
| 35 | producer.start() |
| 36 | consumer.start() |
| 37 | # let the threads do their work |
| 38 | sleep(argv[2]) |
| 39 | run_flag[0] = False |
| 40 | consumer.join() |
| 41 | # verify that the solution was valid |
| 42 | calculate_results(send, recv) |
| 43 | |
| 44 | # parses and checks the command line arguments |
| 45 | def parse_sys_argv(): |
no test coverage detected