On Oct 3, 2019, at 5:01 AM, Jacek Caban jacek@codeweavers.com wrote:
Hi Brendan,
On 10/3/19 12:45 AM, Brendan Shanks wrote:
Hi Jacek, In v2 of the patch I added a test for this (an overlapped read followed by a nonblocking write larger than the pipe buffer), on Wine the write was returning with 0 bytes written. My fix was to only do the wake/free from reselect_write_queue() if there’s no asyncs waiting in the reader read_q, not sure if this is correct or I’m overlooking something though.
Tests looks much better now, thanks. Implementation seems questionable because non-blocking write may block now. For an example do a pending read with size 1 followed by write of size 514. I'd expect write to fail and read to not be satisfied on Windows. I think that with your implementation, read will be satisfied and write will block.
I tried this out, on Windows the write succeeds but only writes 1 byte, and the read completes with 1 byte as well. On Wine this almost works right, but WriteFile returns 0 for the bytes written even though the read completes with 1 byte. I’ll fix this and add these tests for v3.
I also tried a pending read of 1 byte and write 513 bytes, in that case the read and write both complete fully and the 512 bytes stays in the pipe for the next read call.
Brendan