On Mon, Jan 07, 2008 at 03:01:45AM +0900, Brent Roman wrote: > > I've tried getting rid of the stack copying, but it's definitely > > nontrivial. The stack copying causes problems in our C++ extensions, > > so our rule of thumb is to not use threads at all when those > > extensions are being used (there is a safe way to make it work, but > > it's easier just to use an event loop). > > Have you been able to isolate what operations in your C++ extensions > break when threads are used? I could see were signal handlers and C++ > exceptions could be troublesome... It has to do with keeping pointers/references on the heap to objects on the stack. When Ruby switches threads, it copies the stack, overwriting those objects. I believe that 1.9 should fix the problem, though I haven't verified it. Paul