This is the mail archive of the cygwin 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: cygwin source-patch fixing deadlock while writing to serial port

On Mon, Jan 19, 2004 at 10:08:39PM +0100, H. Henning Schmidt wrote:
>I found a potential deadlock while writing to a serial port (e.g. 
>/dev/com1) that has been opened as O_RDWR. The deadlock occurs from time 
>to time (not sure about exact conditions) when I write to that port, 
>while there is data coming in (e.g. from an external device) and I do 
>not read away that data fast enough from the port.
>I did provide a test case a while ago in 
> I digged into 
>the issue some more now and found that the executing thread got 
>sometimes deadlocked in fhandler_serial::raw_write(). It basically ends 
>up in a for(;;) loop and just never hits the break;
>The applied patch adds a safety exit to that for(;;) loop.
>This fixes the testcase referenced above.
>This might not be the last problem lingering in the serial access code 
>(there are some FIXME tokens still around ...), but it is definitely an 
>improvement for me. I thought I'd share that with you.

Can you convince me that this isn't just a band-aid?  I don't understand
why cygwin *shouldn't* hang in a situation like this.  There are
certainly similar situations where this happens on linux.

Perhaps we need a low_priority_sleep (10) in the loop in that situation
or something.


Unsubscribe info:
Problem reports:

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