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]

Fix write deadlock with streaming serial devices


This trivial patch fixes the problem reported here:

http://www.cygwin.com/ml/cygwin/2004-01/msg00664.html

Tested and confirmed by the reporter here:

http://www.cygwin.com/ml/cygwin/2004-01/msg00716.html

and by Martin Farnik in a previous private email discussion.

If the input buffer overflows because a device is streaming faster than
the application is reading, all serial communications cease and calls
return ERROR_OPERATION_ABORTED.  In order to restart communication,
ClearCommError must be called.  Without this patch, a deadlock inside
fhandler_serial::raw_write could occur.

Martin has supplied me with an strace log of another hang, but I have yet
to fully understand it.  A patch for it is hopefully forth comming.

The fhandler_serial::raw_read patch is merely a suggestion to correct a
possible thinko.  Feel free to ignore it, or correct my limited analysis.

Thanks.

2004-01-22  Brian Ford  <ford@vss.fsi.com>

	* fhandler_serial.cc (fhandler_serial::raw_write): Prevent a
	deadlock when the input buffer overflows.
	(fhandler_serial::raw_read): Correct to print the actual error
	and only call PurgeComm when necessary.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax:   314-551-8444

Attachment: fhandler_serial.cc.patch
Description: Text document


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