[Rxtx] RXTX serial port read() returns -1 unexpectedly and then blocks forever on close()
ryan.boder at gmail.com
Fri Mar 4 07:24:48 MST 2011
On Thu, Mar 3, 2011 at 8:52 PM, Trent Jarvi <tjarvi at qbang.org> wrote:
> The windows implementation was done without real documentatino of the
> windows API. I think I had an example from the late 80's early 90's on
> Microsoft's site and some API documentation that was obviously not
> microsofts in Europe. Wayne Roberts had a real need for windows support and
> fixed some major issues it had. My interest at the time was mingw32. I then
> cleaned it up for some specific uses I had later. The read returning -1
> when it should block didn't impact anybody and appeared to help some people.
> It isnt the documented behavior though.
> There could be all sorts of latent bugs in that code but in the real world,
> it gets by in almost all use cases. Its a hack but it worked for 100's of
> thousands of people over a 14 year period. Maybe its time to revisit the
> code but there is more risk than gain for most people. How do you move
> forward and avoid the risk?
The safest and easiest solution would be to add a javadoc comment to
disableReceiveTimeout explaining the difference between the RXTX behavior
and Sunacle's documented behavior so that when someone uses the method in an
IDE like Eclipse a little box would pop up informing them. Generating
javadoc HTML and hosting it on the RXTX website would go a long way too,
when something behaves differently than I expect the first thing I do is
look for the javadoc online.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rxtx