[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    [ruby-core:27352] set_trace_func doesn't allow for differentiation of threads?
From:       Roger Pack <rogerdpack2 () gmail ! com>
Date:       2009-12-30 21:56:08
Message-ID: 87d974fd0912301356v557f39f5j8d55d07c97337ce5 () mail ! gmail ! com
[Download RAW message or body]

Currently it appears that within a set_trace_func proc, a call to
Thread.current sometimes returns Thread.main, even when that isn't the
"right" current thread.

(returns 2 in 1.8.x, 1 in 1.9.x):

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?

Anyway, it currently prevents the ruby-prof gem from being able to
assign timings to the correct threads because calls to
rb_thread_current() act the same as the above, so getting this fixed
would be great for the ruby-prof gem.

(Using GET_THREAD also didn't help).

Thanks!
-r

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic