diff options
author | Miguel de Icaza <miguel@gnome.org> | 2007-08-12 20:18:32 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2007-08-12 20:18:32 +0400 |
commit | c8088c1d5eec66ad73665068a4dff5a390488c1f (patch) | |
tree | daead31ef1ca2833a6ecce59d4d52bb8046430c0 /mcs/class/System/System.IO.Ports/SerialPortStream.cs | |
parent | c1618ae78e6db3dff3bb11153bd8e3ab1955fa8b (diff) |
Second part of fix for bug #81967
2007-08-12 Lukasz Byczynski <lukaszb@forcom.com.pl>
* SerialPortStream.cs: added timeout handling on write
* WinSerialStream.cs: fixed setting handshake flags
svn path=/trunk/mcs/; revision=83922
Diffstat (limited to 'mcs/class/System/System.IO.Ports/SerialPortStream.cs')
-rw-r--r-- | mcs/class/System/System.IO.Ports/SerialPortStream.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mcs/class/System/System.IO.Ports/SerialPortStream.cs b/mcs/class/System/System.IO.Ports/SerialPortStream.cs index 8a775cd35e8..e65f17cb3fe 100644 --- a/mcs/class/System/System.IO.Ports/SerialPortStream.cs +++ b/mcs/class/System/System.IO.Ports/SerialPortStream.cs @@ -161,7 +161,7 @@ namespace System.IO.Ports } [DllImport ("MonoPosixHelper")] - static extern void write_serial (int fd, byte [] buffer, int offset, int count, int timeout); + static extern int write_serial (int fd, byte [] buffer, int offset, int count, int timeout); public override void Write (byte[] buffer, int offset, int count) { @@ -176,7 +176,8 @@ namespace System.IO.Ports throw new ArgumentException ("offset+count", "The size of the buffer is less than offset + count."); - write_serial (fd, buffer, offset, count, write_timeout); + if (write_serial (fd, buffer, offset, count, write_timeout) < 0) + throw new TimeoutException("The operation has timed-out"); } protected override void Dispose (bool disposing) |