[#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:
Mathieu Bouchard <matju@...>
Date:
2003-09-01 20:08:41 UTC
List:
ruby-core #1493
On Mon, 1 Sep 2003 nobu.nokada@softhome.net wrote:
> At Mon, 1 Sep 2003 11:46:21 +0900,
> Mathieu Bouchard wrote:
> > Hi. I have found a bug that is present in version 1.8.0, but not in
> > version 1.6.8. The following should raise a Errno::EAGAIN, but does not
> > anymore: it waits instead.
> Behavior in non-blocking mode has been changed. Also IO#gets
> waits till end of line.
> Do you think it undesirable?
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.
In any case, some of my code has been broken by that, and I want to
prevent that from happening in the future.
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)).
Non-blocking mode, in Ruby, can't be used properly. Contrast this with
Perl's POE and Python's Twisted libraries, which both take care of
organising event-driven IO. The closest in Ruby is still my old
MainLoop.rb, but I haven't really used it myself because of bugs in
non-blocking mode.
________________________________________________________________
Mathieu Bouchard http://artengine.ca/matju