Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix a bug in windows_file_system.cc for reading file #6805
When read_result is TRUE, result should be set to bytes_read.
referenced this pull request
Jan 13, 2017
@meteorcloudy I believe @vit-stepanovs contributed that particular piece of code, and I assume he used overlapped I/O here because it's the easiest way to read from a particular offset without a race condition if multiple threads are accessing the file. (@drpngx: I'm not sure what race condition you mean here. The return value is non-deterministic, sure, but as long as we handle it as Yun does here, I think it's threadsafe.)
The fix looks correct to me... I've had to fix similar issues with Windows API calls that way in the past, and I can't think of a more elegant solution.
Ah, I see what you mean. That does sound ominous, but according to the docs,
(How nice of the doc writer to state the property in triplicate!)