This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] to_slave pipe is full fix


On Mon, Dec 16, 2002 at 02:36:29PM -0500, Christopher Faylor wrote:
> On Mon, Dec 16, 2002 at 01:15:54PM -0600, Steve O wrote:
> -             SetEvent (input_available_event);
> -             ReleaseMutex (input_mutex);
> -             Sleep (10);
> -             rc = WaitForSingleObject (input_mutex, INFINITE);
> +             puts_readahead (p, bytes_left);
> +             ret = 0;
> +             break;
> 
> Won't this introduce a spinning situation since you are no longer
> sleeping?  

The 'break;' should pop us out of the loop.  Did I miss a control
structure?  The idea of the patch at least, was to bail out of a write
if the pipe is full.  

> Were we really inappropriately waiting for the input_mutex in
> this case?

For the case where the application expects the write to not block,
it seems inappropriate to wait.  For the case where the application
does a blocking write, the WriteFile should do the blocking and, unless
there is a problem, write all the bytes.

In fact, looking at it some more, the accept_input while loop is 
superfluous.  Sorry I missed that.  

-steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]