diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2025-05-15 13:00:18 +0200 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2025-05-15 13:32:08 +0200 |
| commit | ed632cd0bacc710b03809c903a978d3fa2cfedfe (patch) | |
| tree | 75a613535c8dc7b582d64c76b844f55a40e0d950 /test | |
| parent | 3d1b8e7298957711998bfb2e8cce09bcc17e4d46 (diff) | |
Add missing lock in `rb_gc_impl_undefine_finalizer`
The table is global so accesses must be synchronized.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13349
Diffstat (limited to 'test')
| -rw-r--r-- | test/objspace/test_ractor.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/objspace/test_ractor.rb b/test/objspace/test_ractor.rb index 4901eeae2e..c5bb656da6 100644 --- a/test/objspace/test_ractor.rb +++ b/test/objspace/test_ractor.rb @@ -14,4 +14,23 @@ class TestObjSpaceRactor < Test::Unit::TestCase end RUBY end + + def test_undefine_finalizer + assert_ractor(<<~'RUBY', require: 'objspace') + def fin + ->(id) { } + end + ractors = 5.times.map do + Ractor.new do + 10_000.times do + o = Object.new + ObjectSpace.define_finalizer(o, fin) + ObjectSpace.undefine_finalizer(o) + end + end + end + + ractors.each(&:take) + RUBY + end end |
