(run_flag, queue, send)
| 61 | |
| 62 | # called by the producer thread |
| 63 | def produce(run_flag, queue, send): |
| 64 | while run_flag[0]: |
| 65 | # simulate production |
| 66 | sleep(random()) |
| 67 | # put widget in buffer |
| 68 | item = Widget() |
| 69 | queue.put(item) |
| 70 | send.push(item) |
| 71 | |
| 72 | # called by the consumer thread |
| 73 | def consume(run_flag, queue, recv, producer): |