From: Nobuyoshi Nakada Date: 2008-04-18T01:38:13+09:00 Subject: Re: ruby_init() and C call stack in Ruby 1.9 Hi, At Fri, 18 Apr 2008 00:22:52 +0900, Suraj N. Kurapati wrote in [ruby-core:16432]: > > Suraj N. Kurapati wrote: > > Yukihiro Matsumoto wrote: > >> No Ruby object should be referred from stack region lower than the > >> position at the time of ruby_init() invocation. > > > > For Ruby 1.8, I was able to guarantee this assumption by only using > > Ruby's C API inside a POSIX thread: the thread preserves the C call > > stack for the life of the Ruby interpreter. > > > > However, for Ruby 1.9, it is not possible to invoke ruby_init() > > inside a POSIX thread (as both you and Nobu have explained in > > ruby-core:15759 and ruby-core:15760). > > > > Therefore, how can I guarantee this assumption for Ruby 1.9? Why can't you call ruby_sysinit() and ruby_init() in the maint thread? > Please suggest some ideas or comment on my idea of calloc()ing a > private Stack area for Ruby (see parent e-mail). Seems like what native thread system does. > P.S. I really wish Ruby's C API was like OpenGL: a state machine. > It doesn't matter from what stack position you query/modify the > machine state. OpenGL has its own GC? -- Nobu Nakada