diff options
| author | Luke Gruber <luke.gruber@shopify.com> | 2025-12-04 16:10:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-04 16:10:21 -0500 |
| commit | de2c2bd60fdce52cc7ba38a25f3e9436442af604 (patch) | |
| tree | d80a975a31dcba5d7633362bceae3afb49990ad5 /test/ruby | |
| parent | d9aced864bed7183059785c3aaf37ae835434f4a (diff) | |
Take VM lock in `class_switch_superclass` (#15356)
Safe multi-ractor subclass list mutation
We need to lock around mutation and accesses of a class's subclasses
list. Unfortunately we also need to do this when creating singleton
classes, as the singleton class does need to go into `super`'s
subclasses list for CC invalidation purposes.
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_class.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb index 10b7655e9a..1faecd0cb2 100644 --- a/test/ruby/test_class.rb +++ b/test/ruby/test_class.rb @@ -917,4 +917,17 @@ CODE end end; end + + def test_safe_multi_ractor_subclasses_list_mutation + assert_ractor "#{<<~"begin;"}\n#{<<~'end;'}" + begin; + 4.times.map do + Ractor.new do + 20_000.times do + Object.new.singleton_class + end + end + end.each(&:join) + end; + end end |
