Mercurial > hg
comparison mercurial/worker.py @ 49230:5d28246b9acc
worker: explain why pickle reading stream has to be unbuffered
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sat, 21 May 2022 22:22:19 +0200 |
parents | cdb85d0512b8 |
children | 4d42a5fb70bf |
comparison
equal
deleted
inserted
replaced
49229:ed9170ff791a | 49230:5d28246b9acc |
---|---|
278 os._exit(ret & 255) | 278 os._exit(ret & 255) |
279 pids.add(pid) | 279 pids.add(pid) |
280 selector = selectors.DefaultSelector() | 280 selector = selectors.DefaultSelector() |
281 for rfd, wfd in pipes: | 281 for rfd, wfd in pipes: |
282 os.close(wfd) | 282 os.close(wfd) |
283 # The stream has to be unbuffered. Otherwise, if all data is read from | |
284 # the raw file into the buffer, the selector thinks that the FD is not | |
285 # ready to read while pickle.load() could read from the buffer. This | |
286 # would delay the processing of readable items. | |
283 selector.register(os.fdopen(rfd, 'rb', 0), selectors.EVENT_READ) | 287 selector.register(os.fdopen(rfd, 'rb', 0), selectors.EVENT_READ) |
284 | 288 |
285 def cleanup(): | 289 def cleanup(): |
286 signal.signal(signal.SIGINT, oldhandler) | 290 signal.signal(signal.SIGINT, oldhandler) |
287 waitforworkers() | 291 waitforworkers() |