about summary refs log tree commit diff
path: root/src/libstd/rt/stack.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-07 17:21:37 -0700
committerbors <bors@rust-lang.org>2014-05-07 17:21:37 -0700
commitab22d99e73f81f35dd4edbdc9b27152dc653f5b6 (patch)
treebacfb76b9a43a1a39cef0e3ed0fdf51ee12f6ea6 /src/libstd/rt/stack.rs
parentc217a844793034c181bd4457b9797b97a2c66f58 (diff)
parentec9ade938e9e4aa710f4351e48a8fda1037352aa (diff)
downloadrust-ab22d99e73f81f35dd4edbdc9b27152dc653f5b6.tar.gz
rust-ab22d99e73f81f35dd4edbdc9b27152dc653f5b6.zip
auto merge of #13751 : alexcrichton/rust/io-close-read, r=brson
Two new methods were added to TcpStream and UnixStream:

    fn close_read(&mut self) -> IoResult<()>;
    fn close_write(&mut self) -> IoResult<()>;

These two methods map to shutdown()'s behavior (the system call on unix),
closing the reading or writing half of a duplex stream. These methods are
primarily added to allow waking up a pending read in another task. By closing
the reading half of a connection, all pending readers will be woken up and will
return with EndOfFile. The close_write() method was added for symmetry with
close_read(), and I imagine that it will be quite useful at some point.

Implementation-wise, librustuv got the short end of the stick this time. The
native versions just delegate to the shutdown() syscall (easy). The uv versions
can leverage uv_shutdown() for tcp/unix streams, but only for closing the
writing half. Closing the reading half is done through some careful dancing to
wake up a pending reader.

As usual, windows likes to be different from unix. The windows implementation
uses shutdown() for sockets, but shutdown() is not available for named pipes.
Instead, CancelIoEx was used with same fancy synchronization to make sure
everyone knows what's up.

cc #11165
Diffstat (limited to 'src/libstd/rt/stack.rs')
0 files changed, 0 insertions, 0 deletions