(directory, file_count)
| 198 | f.flush() |
| 199 | |
| 200 | def start_write_threads(directory, file_count): |
| 201 | paths = [] |
| 202 | for i in range(file_count): |
| 203 | path = os.path.join(directory, str(i)) |
| 204 | with open(path, "w"): |
| 205 | # Make sure the file at this path will exist when |
| 206 | # the reading thread tries to poll it. |
| 207 | pass |
| 208 | paths.append(path) |
| 209 | args = (path, 10, 0.1) |
| 210 | thread = Thread(target=write_random_data, args=args) |
| 211 | thread.start() |
| 212 | return paths |
| 213 | |
| 214 | def close_all(handles): |
| 215 | time.sleep(1) |