summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2022-06-15 14:37:41 +0200
committerJean Boussier <jean.boussier@gmail.com>2022-06-17 09:08:26 +0200
commitb6c1e1158d71b533b255ae7a2731598455918071 (patch)
tree9b3fdf4eb4a54e56d77ec7732ff079bdd9f896bc /test
parent20d4168250fb1f534cf2db7c44998b25252a70f8 (diff)
downloadruby-b6c1e1158d71b533b255ae7a2731598455918071.tar.gz
GVL Instrumentation API: add STARTED and EXITED events
[Feature #18339] After experimenting with the initial version of the API I figured there is a need for an exit event to cleanup instrumentation data. e.g. if you record data in a {thread_id -> data} table, you need to free associated data when a thread goes away.
Diffstat (limited to 'test')
-rw-r--r--test/-ext-/thread/test_instrumentation_api.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/-ext-/thread/test_instrumentation_api.rb b/test/-ext-/thread/test_instrumentation_api.rb
index d110348d73..ff76e95bcd 100644
--- a/test/-ext-/thread/test_instrumentation_api.rb
+++ b/test/-ext-/thread/test_instrumentation_api.rb
@@ -44,8 +44,10 @@ class TestThreadInstrumentation < Test::Unit::TestCase
counters = Marshal.load(read_pipe)
read_pipe.close
counters.each do |c|
- assert_predicate c,:nonzero?, "Call counters: #{counters.inspect}"
+ assert_predicate c, :nonzero?, "Call counters: #{counters.inspect}"
end
+
+ assert_equal counters.first, counters.last # exited as many times as we entered
ensure
Bug::ThreadInstrumentation::unregister_callback
end