From: Joel VanderWerf Date: 2005-10-07T13:13:12+09:00 Subject: Re: Q: How to get backtrace of another thread? ruby-lang@wingding.demon.nl wrote: > How do I get a backtrace of another (possibly running) Thread? I was asking the same question just a few days ago, but I didn't come up with anything either. The otherThread.raise approach isn't completely useless. It's destructive, but it will tell you what the thread is doing (or what it was doing before going to sleep). You just have to make sure to catch the exception in otherThread's outermost block (or somewhere): otherThread = Thread.new do begin # ... rescue Exeption => e puts e.backtrace end end Any reason why it would be hard (in terms of the ruby thread implementation) to take a "snapshot" of another thread's backtrace? It would be nice to have something like otherThread.trap MyTestException do puts backtrace end with the obvious meaning... -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407