Hi,

At Wed, 30 Jan 2002 20:04:14 +0900,
ts <decoux / moulon.inra.fr> wrote:
> P>     rb_eval_string(
> P>         "class IO\n"
> P>         "  PIPE_BUFFERS = Hash.new\n"
> P>         "  def self.pipe_buffer_finalizer(buf)\n"
> P>         "    PIPE_BUFFERS[buf] = true\n"
> P>         "    return proc { PIPE_BUFFERS.delete(buf) }\n"
> P>         "  end\n"
> P>         "  def setvbuf(mode, buf=nil)\n"
> P>         "    if buf then\n"
> P>         "      ObjectSpace.define_finalizer(self, IO.pipe_buffer_finalizer(buf))\n"
> P>         "    end\n"
> P>         "    c_setvbuf(mode, buf)\n"
> P>         "  end\n"
> 
>  What I've not understood is why you want to use a constant (PIPE_BUFFERS)
>  rather than an instance variable ?

If you mean IO instance object's instance variable, I guess he
wants to prevent the buffer from GC.

But, IO#setvbuf(IO::NBF) looks to be equivalent to IO#sync=true
actually.  I can't understand why he must set $stdout.sync to
false.

-- 
Nobu Nakada