Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2007-08-12 20:18:32 +0400
committerMiguel de Icaza <miguel@gnome.org>2007-08-12 20:18:32 +0400
commitc8088c1d5eec66ad73665068a4dff5a390488c1f (patch)
treedaead31ef1ca2833a6ecce59d4d52bb8046430c0 /mcs/class/System/System.IO.Ports/SerialPortStream.cs
parentc1618ae78e6db3dff3bb11153bd8e3ab1955fa8b (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.cs5
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)