B
Brad
All:
Ruby threading problems
Using ruby 1.8.0 Preview 5 (Porting ruby to OpenVMS Alpha)
============================================================================
==
I Realize that OpenVMS is not an officially supported OS for ruby but I'm
hoping that someone will see something that I'm missing or have encountered
the problems described.
Using a simple ruby script that makes use of threads causes ruby interpreter
to stack dump on OpenVMS.
The following is the ruby threading script that is used:
puts "main"
thread1=Thread.new do
puts "thread"
end
I've narrowed the problem down to what I think is a setjmp/longjmp problem.
But the problem is not solely a
setjmp/longjmp problem as the following example proves that setjmp/longjmp
on OpenVMS works just fine.
#include <stdio.h>
#include <stdlib.h>
#include<setjmp.h>
void main()
{
jmp_buf env;
int i;
i=setjmp(env);
printf("i= %d\n",i);
if(i==0)
printf("I am in if ..\n");
else{
printf("I am in else too...\n");
exit(0);
}
longjmp(env,2);
}
I first thought that the context (contained in rb_thread_t structure) was
being corrupted. However, when run through the debugger the context is not
changed. The next idea
was to edit eval.c to generate a "no-op" by using the following code:
(* This is located in rb_thread_start_0 *)
(* restThr is a global integer value that is initialized to 0. This is
a safeguard so ruby doesn't try to restore a non-existent context *)
....
THREAD_SAVE_CONTEXT(curr_thread);
if(restThr == 0) {
rb_thread_restore_context(curr_thread,RESTORE_NORMAL);
}
....
There appear to be no defines in config.h or defines.h related to threads.
Running ruby through the debugger with the "no-op" shows ruby dying in
stack_extend. A few questions about stack_extend:
Q: (a) What is the intent of this routine?
(b) Why does this routine call rb_thread_restore_context?
Q: Are there any known thread implementation issues for alternate platforms.
Any help would be appreciated.
============================================================================
=
Ruby threading problems
Using ruby 1.8.0 Preview 5 (Porting ruby to OpenVMS Alpha)
============================================================================
==
I Realize that OpenVMS is not an officially supported OS for ruby but I'm
hoping that someone will see something that I'm missing or have encountered
the problems described.
Using a simple ruby script that makes use of threads causes ruby interpreter
to stack dump on OpenVMS.
The following is the ruby threading script that is used:
puts "main"
thread1=Thread.new do
puts "thread"
end
I've narrowed the problem down to what I think is a setjmp/longjmp problem.
But the problem is not solely a
setjmp/longjmp problem as the following example proves that setjmp/longjmp
on OpenVMS works just fine.
#include <stdio.h>
#include <stdlib.h>
#include<setjmp.h>
void main()
{
jmp_buf env;
int i;
i=setjmp(env);
printf("i= %d\n",i);
if(i==0)
printf("I am in if ..\n");
else{
printf("I am in else too...\n");
exit(0);
}
longjmp(env,2);
}
I first thought that the context (contained in rb_thread_t structure) was
being corrupted. However, when run through the debugger the context is not
changed. The next idea
was to edit eval.c to generate a "no-op" by using the following code:
(* This is located in rb_thread_start_0 *)
(* restThr is a global integer value that is initialized to 0. This is
a safeguard so ruby doesn't try to restore a non-existent context *)
....
THREAD_SAVE_CONTEXT(curr_thread);
if(restThr == 0) {
rb_thread_restore_context(curr_thread,RESTORE_NORMAL);
}
....
There appear to be no defines in config.h or defines.h related to threads.
Running ruby through the debugger with the "no-op" shows ruby dying in
stack_extend. A few questions about stack_extend:
Q: (a) What is the intent of this routine?
(b) Why does this routine call rb_thread_restore_context?
Q: Are there any known thread implementation issues for alternate platforms.
Any help would be appreciated.
============================================================================
=