summaryrefslogtreecommitdiff
path: root/trace_point.rb
diff options
context:
space:
mode:
authorLuke Gruber <luke.gruber@shopify.com>2025-12-16 14:06:55 -0500
committerGitHub <noreply@github.com>2025-12-16 14:06:55 -0500
commit4fb537b1ee28bb37dbe551ac65c279d436c756bc (patch)
tree03a8f339cb53f6b9b0b359af0d50bdcbc5eefcc9 /trace_point.rb
parentd209e6f1c0a93ad3ce1cc64dd165a6b67672614d (diff)
Make tracepoints with set_trace_func or TracePoint.new ractor local (#15468)
Before this change, GC'ing any Ractor object caused you to lose all enabled tracepoints across all ractors (even main). Now tracepoints are ractor-local and this doesn't happen. Internal events are still global. Fixes [Bug #19112]
Diffstat (limited to 'trace_point.rb')
-rw-r--r--trace_point.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/trace_point.rb b/trace_point.rb
index 682398ec3f..7e8af21a68 100644
--- a/trace_point.rb
+++ b/trace_point.rb
@@ -26,7 +26,7 @@
# change. Instead, it is recommended to specify the types of events you
# want to use.
#
-# To filter what is traced, you can pass any of the following as +events+:
+# To filter what is traced, you can pass any number of the following as +events+:
#
# +:line+:: Execute an expression or statement on a new line.
# +:class+:: Start a class or module definition.
@@ -74,7 +74,7 @@ class TracePoint
#
# A block must be given; otherwise, an ArgumentError is raised.
#
- # If the trace method isn't included in the given events filter, a
+ # If the trace method isn't supported for the given event(s) filter, a
# RuntimeError is raised.
#
# TracePoint.trace(:line) do |tp|
@@ -89,7 +89,9 @@ class TracePoint
# end
# $tp.lineno #=> access from outside (RuntimeError)
#
- # Access from other threads is also forbidden.
+ # Access from other ractors, threads or fibers is forbidden. TracePoints are active
+ # per-ractor so if you enable a TracePoint in one ractor, other ractors will not be
+ # affected.
#
def self.new(*events)
Primitive.attr! :use_block