nyholku/purejavacomm — pull request #45 by michael72 (2013-11-28 12:53:40+00:00)
Title: pull request: write should not block infinitely when in pending

Having a lot of issues with jssc and other serial ports for Java, a colleague found your solution on the internet. I adapted our serial access classes to your purejavacomm - and really works fine.
Except - I get an error in one situation: when there is a lot of traffic to and from the serial interface and the write comes into pending state and in that moment we switch off our device, the write operation hangs completely in the WaitForMultipleObjects(...., INFINITE). So, my first try was to introduce a timeout here, which didn't work yet. But also I added "return 0" and it works like a charm! Now I can plug and unplug the external device as often as I want, and our "ConnectionServer", which handles the serial connections using purejavacomm, never hangs.
Regarding the rest of the code, I don't have a well enough overview to say, if the change I made was correct. So, if you please have a look and send me a small feedback, that'd be great! Thanks!
Sincerely, Michael Schulte