(directory, file_count)
| 116 | f.flush() |
| 117 | |
| 118 | def start_write_threads(directory, file_count): |
| 119 | paths = [] |
| 120 | for i in range(file_count): |
| 121 | path = os.path.join(directory, str(i)) |
| 122 | with open(path, "w"): |
| 123 | # Make sure the file at this path will exist when |
| 124 | # the reading thread tries to poll it. |
| 125 | pass |
| 126 | paths.append(path) |
| 127 | args = (path, 10, 0.1) |
| 128 | thread = Thread(target=write_random_data, args=args) |
| 129 | thread.start() |
| 130 | return paths |
| 131 | |
| 132 | def close_all(handles): |
| 133 | time.sleep(1) |