(workers)
| 107 | from threading import Thread |
| 108 | |
| 109 | def execute(workers): |
| 110 | threads = [Thread(target=w.map) for w in workers] |
| 111 | for thread in threads: |
| 112 | thread.start() |
| 113 | for thread in threads: |
| 114 | thread.join() |
| 115 | |
| 116 | first, *rest = workers |
| 117 | for worker in rest: |
| 118 | first.reduce(worker) |
| 119 | return first.result |
| 120 | |
| 121 | |
| 122 | print("Example 8") |