From: nobu.nokada@... Date: 2004-09-10T10:22:47+09:00 Subject: Re: [PATCH] dir.c --- Dir.chdir error handling Hi, At Fri, 10 Sep 2004 06:03:28 +0900, H.Yamamoto wrote in [ruby-core:03369]: > >Well, I meant just about preventing a work object from GC; > >making the argument `data2' of rb_ensure() volatile. > > I don't know well, but > > VALUE v = ...... > > /* GC happened!! before assigned to volatile */ > > rb_ensure(......, v); /* v is volatile VALUE */ > > is safe? In that case, v should be stored somewhere in the function and subsequent function calls, perhaps on the stack or in a register, anyway possible to be restored and scannable by GC. Otherwise it can't be used at calling rb_ensure(). So I think it's safe. There is a potential danger only when the VALUE is no longer used after any use of its internal pointer. Since data2 in rb_ensure() is used only once at calling e_proc, it may not be a "barrier" in the proc and the proc has to keep it in mind. -- Nobu Nakada