From: SASADA Koichi Date: 2009-06-09T09:33:39+09:00 Subject: [ruby-core:23764] Re: [Bug #977] caller for all threads patch Rocky Bernstein wrote:: > One thing I think might be cool is rather than raising an error for a > negative Fixnum value is to count from the other end. So caller(-1) is the > least-recent call. > > If you want me to try my hand at extending the below, let me know. Check the following code. >>> VALUE >>> +rb_thread_backtrace(VALUE thval, int lev) >>> +{ >>> + rb_thread_t *th; >>> + GetThreadPtr(thval, th); >>> + >>> + if (th->status != THREAD_KILLED && GET_THREAD() != th) { >>> + lev--; >>> + } >>> + >>> + return vm_backtrace(th, lev); >>> +} -- // SASADA Koichi at atdot dot net