From: ts Date: 2003-11-27T19:14:44+09:00 Subject: Re: Ruby thread problems >>>>> "B" == Brad writes: B> Q: Doesn't the setjmp/longjmp maintain the stack information? Seems to me that B> setjmp/longjmp would be quite unusable if it didn't maintain stack B> information. longjmp restore the stack registers (%esp on 80x86), not the stack content. Say another way, this is valid in C int g() { longjmp(jmp, val); } int f() { setjmp(jmp); g(); } but this don't work int g() { setjmp(jmp); } int f() { g(); longjmp(jmp, val); } B> Perhaps this is a naive assumption on my part as I have not had opportunity to B> use setjmp/longjmp before now. When a thread is stopped, ruby store the content of the stack in stk_ptr, when it want to resume a thread it must restore the stack pointers before calling longjmp() Guy Decoux