mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Throw RuntimeError if getting/setting ractor local storage for non-main ractor
[Bug #19367]
This commit is contained in:
parent
7517d7629d
commit
c941fced21
Notes:
git
2025-05-13 11:18:23 +00:00
2 changed files with 26 additions and 2 deletions
|
@ -1564,6 +1564,24 @@ assert_equal '1', %q{
|
|||
}.take
|
||||
}
|
||||
|
||||
# Ractor-local storage
|
||||
assert_equal '2', %q{
|
||||
Ractor.new {
|
||||
fails = 0
|
||||
begin
|
||||
Ractor.main[:key] # cannot get ractor local storage from non-main ractor
|
||||
rescue => e
|
||||
fails += 1 if e.message =~ /Cannot get ractor local/
|
||||
end
|
||||
begin
|
||||
Ractor.main[:key] = 'val'
|
||||
rescue => e
|
||||
fails += 1 if e.message =~ /Cannot set ractor local/
|
||||
end
|
||||
fails
|
||||
}.take
|
||||
}
|
||||
|
||||
###
|
||||
### Synchronization tests
|
||||
###
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue