From: Roger Pack Date: 2010-01-01T04:20:13+09:00 Subject: [ruby-core:27361] Re: set_trace_func doesn't allow for differentiation of threads? > all_threads = {} > set_trace_func proc { > all_threads[Thread.current] = true > } > def go; end > Thread.new { go }.join # create a new thread after having called set_trace_func > puts all_threads.length # should be 2, I think. > > Is this expected? > I guess Thread.current is correct, but new-thread is not traced. > Because set_trace_func affects only living thread on call it. > (please see set_threads_event_flags() in thread.c) > > I'm afraid I don't know this is expected or not. Appears others have run into this before http://redmine.ruby-lang.org/issues/show/2012 (my hunch is it's unexpected). Could the maintainer of thread.c take a look at Mark's patch in ticket 2012? I'd be happy to add a unit test or two [the above code is a pretty good unit test for it, actually, and shows how it differs]. Happy New Year. -r