(handles, interval, output_path)
| 80 | from threading import Lock, Thread |
| 81 | |
| 82 | def run_threads(handles, interval, output_path): |
| 83 | with open(output_path, "wb") as output: |
| 84 | lock = Lock() |
| 85 | |
| 86 | def write(data): |
| 87 | with lock: |
| 88 | output.write(data) |
| 89 | |
| 90 | threads = [] |
| 91 | for handle in handles: |
| 92 | args = (handle, interval, write) |
| 93 | thread = Thread(target=tail_file, args=args) |
| 94 | thread.start() |
| 95 | threads.append(thread) |
| 96 | |
| 97 | for thread in threads: |
| 98 | thread.join() |
| 99 | |
| 100 | |
| 101 | print("Example 4") |
no test coverage detected