Ractor.[]
and Ractor.[]=
`Ractor#[]/[]=` is only for accessors to the current ractor, so that `Ractor.[]/[]=` is simpler. [Feature #20715]
This commit is contained in:
parent
f0d0c030c0
commit
075a102c93
Notes:
git
2024-11-08 09:03:09 +00:00
14
ractor.rb
14
ractor.rb
@ -834,16 +834,26 @@ class Ractor
|
||||
end
|
||||
end
|
||||
|
||||
# get a value from ractor-local storage
|
||||
# get a value from ractor-local storage of current Ractor
|
||||
def [](sym)
|
||||
Primitive.ractor_local_value(sym)
|
||||
end
|
||||
|
||||
# set a value in ractor-local storage
|
||||
# set a value in ractor-local storage of current Ractor
|
||||
def []=(sym, val)
|
||||
Primitive.ractor_local_value_set(sym, val)
|
||||
end
|
||||
|
||||
# get a value from ractor-local storage of current Ractor
|
||||
def self.[](sym)
|
||||
Primitive.ractor_local_value(sym)
|
||||
end
|
||||
|
||||
# set a value in ractor-local storage of current Ractor
|
||||
def self.[]=(sym, val)
|
||||
Primitive.ractor_local_value_set(sym, val)
|
||||
end
|
||||
|
||||
# returns main ractor
|
||||
def self.main
|
||||
__builtin_cexpr! %q{
|
||||
|
Loading…
x
Reference in New Issue
Block a user