Sha256: d2d563ce5a4bbaa46503893ff9fcf417edde2711309b8a26c1dbc60f1533979d
Contents?: true
Size: 575 Bytes
Versions: 16
Compression:
Stored size: 575 Bytes
Contents
exit 0 if !defined?(Ractor) # This affects all tracepoints, including internal ones def hello "world" end traced_calls = 0 # Enable tracing tracepoint = TracePoint.trace(:call) do |tp| traced_calls += 1 if tp.callee_id == :hello end 5.times { hello } # Create a ractor and let it be garbage collected r = Ractor.new { 10 } r.take r_id = r.object_id r = nil until (ObjectSpace._id2ref(r_id) rescue nil).nil? GC.start end # Trigger extra calls to be traced, w/ Ractor enabled, they won't be. 5.times { hello } tracepoint.disable exit traced_calls == 10 ? 0 : 1
Version data entries
16 entries across 16 versions & 1 rubygems