From 4eb53360541baf3e6df36dc0f0766bc7c1c9f8be Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 17 Oct 2013 17:04:51 -0700 Subject: Move as much I/O as possible off of native::io When uv's TTY I/O is used for the stdio streams, the file descriptors are put into a non-blocking mode. This means that other concurrent writes to the same stream can fail with EAGAIN or EWOULDBLOCK. By all I/O to event-loop I/O, we avoid this error. There is one location which cannot move, which is the runtime's dumb_println function. This was implemented to handle the EAGAIN and EWOULDBLOCK errors and simply retry again and again. --- src/libstd/rt/rtio.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstd/rt/rtio.rs') diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index c779be01046..4a4ce4edcc2 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -97,7 +97,7 @@ pub trait IoFactory { fn unix_bind(&mut self, path: &CString) -> Result<~RtioUnixListener, IoError>; fn unix_connect(&mut self, path: &CString) -> Result<~RtioPipe, IoError>; - fn tty_open(&mut self, fd: c_int, readable: bool, close_on_drop: bool) + fn tty_open(&mut self, fd: c_int, readable: bool) -> Result<~RtioTTY, IoError>; } @@ -182,6 +182,7 @@ pub trait RtioTTY { fn write(&mut self, buf: &[u8]) -> Result<(), IoError>; fn set_raw(&mut self, raw: bool) -> Result<(), IoError>; fn get_winsize(&mut self) -> Result<(int, int), IoError>; + fn isatty(&self) -> bool; } pub trait PausibleIdleCallback { -- cgit 1.4.1-3-g733a5