in reply to Re^2: Win32::SerialPort Error: Overlapped-I/O operation is in progress
in thread Win32::SerialPort Error: Overlapped-I/O operation is in progress
Thanks for taking the time to comment. Sorry about the confusion surrounding my post. Both Perl and Tk were closed before restarting.
There are actually two issues here. One regards closing the port with characters remaining. The sensible approach, I think, would be for the system just to empty the buffer on a close, rather to wait for any handshaking to unblock (which may never happen) or to leave the port in a closed-but-nonempty state. If the programmer is concerned about those last characters getting to the connected device (I'm not), he can check the transmit buffer and wait for it to empty before issuing the close command. But when a close is issued, it should mean just that -- graceless though it might be -- regardless of state. And the system should be relied upon to mop up any messes left behind.
The second issue regards opening a port that's in this weird state of limbo. Non-Perl apps don't seem to have a problem recognizing that the port can be forced back open and proceed accordingly without complaint. It would be nice if Perl apps could do the same.
|
|---|