From 238cc5974ba593adbeec2ba942611ff33b234792 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 13 May 2006 07:43:41 +0000 Subject: update readpartial doc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 01ffb79a4b..89c5e2b638 100644 --- a/io.c +++ b/io.c @@ -1242,10 +1242,12 @@ io_getpartial(int argc, VALUE *argv, VALUE io) /* * call-seq: - * ios.readpartial(maxlen[, outbuf]) => string, outbuf + * ios.readpartial(maxlen) => string + * ios.readpartial(maxlen, outbuf) => outbuf * - * Reads at most maxlen bytes from the I/O stream but - * it blocks only if ios has no data immediately available. + * Reads at most maxlen bytes from the I/O stream. + * It blocks only if ios has no data immediately available. + * It doesn't block if some data available. * If the optional outbuf argument is present, * it must reference a String, which will receive the data. * It raises EOFError on end of file. @@ -1285,11 +1287,13 @@ io_getpartial(int argc, VALUE *argv, VALUE io) * r.readpartial(4096) #=> "def\n" "" "ghi\n" * r.readpartial(4096) #=> "ghi\n" "" "" * - * Note that readpartial is nonblocking-flag insensitive. - * It blocks on the situation IO#sysread causes Errno::EAGAIN. + * Note that readpartial behaves similar to sysread. + * The differences are: + * * If the buffer is not empty, read from the buffer instead of "sysread for buffered IO (IOError)". + * * It doesn't cause Errno::EAGAIN and Errno::EINTR. When readpartial meets EAGAIN and EINTR by read system call, readpartial retry the system call. * - * Also note that readpartial behaves similar to sysread in blocking mode. - * The behavior is identical when the buffer is empty. + * The later means that readpartial is nonblocking-flag insensitive. + * It blocks on the situation IO#sysread causes Errno::EAGAIN as if the fd is blocking mode. * */ -- cgit v1.2.3