[#1491] bug — Mathieu Bouchard <matju@...>
6 messages
2003/09/01
[#1492] non-blocking mode behavior (Re: bug)
— nobu.nokada@...
2003/09/01
Hi,
[#1512] New tests — Dave Thomas <Dave@...>
I was looking through the new test/ruby/* stuff just now, and notices
6 messages
2003/09/05
[#1533] GC disable / enable question — Torsten Rueger <torsten.rueger@...>
Moi,
7 messages
2003/09/17
[#1534] Re: GC disable / enable question
— nobu.nokada@...
2003/09/17
Hi,
[#1541] How to debug ? — Torsten Rueger <torsten.rueger@...>
Moi,
6 messages
2003/09/19
[#1542] Re: How to debug ?
— ts <decoux@...>
2003/09/19
>>>>> "T" == Torsten Rueger <torsten.rueger@hiit.fi> writes:
[#1551] Hashes as keys — "Nathaniel Talbott" <nathaniel@...>
I was just playing around with Hash#hash and discovered that you can't use a
13 messages
2003/09/23
[#1552] Re: Hashes as keys
— Jim Freeze <jim@...>
2003/09/23
On Wednesday, 24 September 2003 at 6:21:33 +0900, Nathaniel Talbott wrote:
[#1556] ostruct.rb patch — "Nathaniel Talbott" <nathaniel@...>
I've been finding OpenStruct to be very useful lately, and then I discovered
9 messages
2003/09/24
[#1557] Re: ostruct.rb patch
— "NAKAMURA, Hiroshi" <nahi@...>
2003/09/24
Hi, Nathaniel,
Re: non-blocking mode behavior (Re: bug)
From:
Tanaka Akira <akr@...17n.org>
Date:
2003-09-02 03:05:11 UTC
List:
ruby-core #1494
In article <Pine.LNX.4.21.0308312351340.932-100000@hostname.2y.net>,
Mathieu Bouchard <matju@sympatico.ca> writes:
> Proper behaviour for nonblocking operations is:
>
> * never, ever wait
>
> * never raise Errno::E000 ("Success"), which is always a bug
> (in the past, many bugs in nonblocking mode fell in that category)
>
> * if nothing can be done, raise Errno::EAGAIN
>
> * if not all can be done, give what was received or how much was
> sent, so that the operation can be resumed by the calling code
> at its discretion
>
> * if something is buffered, then any partially-read block should
> end up in the buffer; it should not be discarded.
>
> If any of the above is not clear or questionable or you think there
> should be special cases, please inform me.
Because non-blocking mode may be set by other process if opened file
is shared, such blocking/nonblocking sensitive behaviour may cause
problem.
For example, ssh set stderr non-blocking mode and problem is caused
with emacs:
http://groups.google.com/groups?th=e4df2fdc1f4f4950
http://sources.redhat.com/ml/bug-glibc/2002-08/threads.html#00041
http://sources.redhat.com/ml/bug-glibc/2002-08/threads.html#00186
I think usual methods should work as blocking mode even if nonblocking
mode i.e. such methods should retry the operation when EAGAIN is
occured.
Since sometimes nonblocking behaviour is required, such behaviour
should be provided by different method such as
read_nonblock/write_nonblock. They should temporally set non-blocking
mode if necessary. They should work as your "proper behaviour for
nonblocking operations".
> I think I could migrate everything to threads, to avoid the numerous
> problems in nonblocking mode, but I have to make sure I don't need to read
> "as much as possible" data from a socket, because that can't be done in
> threaded IO (except by a very slow loop of read(1)).
Use sysread.
If you want to use sysread and other IO methods, my nonstdio.rb may
help you. (see RAA)
--
Tanaka Akira