From: SASADA Koichi Date: 2010-12-16T02:48:07+09:00 Subject: [ruby-core:33730] Re: [Ruby 1.9-Feature#2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine Hi, Suraj, I'm sorry for late response. I missed this thread. I read the last patch: http://redmine.ruby-lang.org/attachments/download/1153 and I need to say "no". As nobu said at first, this patch is not considering the multi-threading. (and using global variables should not be accepted :) The patch is too ad-hoc modification) I propose another API. idea 1: // API for C extension. // User needs to know thread value. rb_thread_set_stack(VALUE thread_val, upper, lower) { th = thread_data(thread_val); th->upper = upper; th->lower = lower; } idea 2: // API called from not a Ruby world ruby_bind_stack_for_current_native_thread(upper, lower) { th = thread_data_for_current_native_thread(); if (th == 0) { // Current native thread does not have // the related ruby thread. return 0; } th->upper = upper; th->lower = lower; return 1; } BTW, how to get the correct "upper"/"lower" address of stack? (2010/12/16 0:37), Yukihiro Matsumoto wrote: > Hi, > > Ko1, could you respond to this issue, please? Either positively or > negatively, we should not leave this untouched. > > matz. > > In message "Re: [ruby-core:33727] [Ruby 1.9-Feature#2294] [PATCH] ruby_bind_stack() to embed Ruby in coroutine" > on Thu, 16 Dec 2010 00:27:40 +0900, Anonymous Anonymous writes: > > |Could we finally get this patch commited, please? It's not like it's a thousand line behemoth and it solves a very real problem - it's impossible to embed Ruby into a pthread without it. I really see no reason not to commit this. > |http://redmine.ruby-lang.org/issues/show/2294 > -- // SASADA Koichi at atdot dot net