Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Embedding ruby interpreter
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Steve Hart, post: 4674303"] Hi We are looking at upgrading our current version of ruby 1.8.7 to latest 1.9.2-p0, We have been running ruby embedded within a pthread with a swigged up interface for about 7 years and it has worked fine. On changing to 1.9 we get a crash on initialistaiion the first time the gc is called. This occurs in mark_current_machine_context Under 1.8.7 we initialised the ruby thread thus int ScriptThread::run() { int addr; ruby_init(); Init_stack((void *)&addr); ruby_script("embedded"); ruby_init_loadpath(); Init_gm(); // swigged up interface ..... } Under 1.9 I changed this to: RUBY_GLOBAL_SETUP int ScriptThread::run() { //ruby_sysinit(&argc, &argv); // commented out, no args available { RUBY_INIT_STACK; ruby_init(); } Init_gm(); ..... } Note that our thread is created thru QT using pthreads. We also compile 1.8.7 without pthread support. Our interpreter runs exclusively in this thread and all VALUE's created in C are properly wrapped and marked. I have read the threads from [URL]http://www.ruby-forum.com/topic/144747[/URL] [URL]http://redmine.ruby-lang.org/issues/show/2294[/URL] From these it would appear that a) The ruby initialisation must be done in main Is this a change from 1.8.7? What if we are dynamically loaded and have no access to main? b) The thread should be created using rb_thread_create Is this true? If so, why? c) disabling pthread support when compiling ruby has been deprecated. What does this mean? - Does ruby use threads itself? I briefly tried to disable the gc and then got a crash d) Should we apply the patch from 2294? What is the correct way to do this? I would greatly appreciate any help anyone could give. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Embedding ruby interpreter
Top