[PATCH 3/4] server: Don't block when writing to named pipes in PIPE_NOWAIT mode.

Brendan Shanks bshanks at codeweavers.com
Wed Oct 2 17:45:38 CDT 2019


> On Oct 1, 2019, at 11:38 AM, Jacek Caban <jacek at codeweavers.com> wrote:
> 
> On 10/1/19 8:21 PM, Brendan Shanks wrote:
>>> On Oct 1, 2019, at 9:51 AM, Jacek Caban <jacek at codeweavers.com> wrote:
>>> 
>>> On 10/1/19 6:16 PM, Brendan Shanks wrote:
>>>> +                wake_message( message, message->iosb->in_size );
>>>> +            else if (message->async && (pipe_end->flags & NAMED_PIPE_NONBLOCKING_MODE))
>>>> +                wake_message( message, 0 );
>>> 
>>> Note that this will terminate write async, but leave the message queued. Is it intended to do that?
>> No it’s not, thanks for catching that. Would I just need to call free_message() after wake_message()?
> 
> 
> Note that there is one more problem with this: there may be a pending read, which current write may satisfy and thus complete without blocking. It would really need tests to be sure, but I'd expect that we should check if the call will block before queuing it. It may be useful to keep track of total pending read quota in pipe end, but that's just a guess without tests.

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.

Brendan


More information about the wine-devel mailing list