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
|
||||||
end
|
end
|
||||||
|
|
||||||
# get a value from ractor-local storage
|
# get a value from ractor-local storage of current Ractor
|
||||||
def [](sym)
|
def [](sym)
|
||||||
Primitive.ractor_local_value(sym)
|
Primitive.ractor_local_value(sym)
|
||||||
end
|
end
|
||||||
|
|
||||||
# set a value in ractor-local storage
|
# set a value in ractor-local storage of current Ractor
|
||||||
def []=(sym, val)
|
def []=(sym, val)
|
||||||
Primitive.ractor_local_value_set(sym, val)
|
Primitive.ractor_local_value_set(sym, val)
|
||||||
end
|
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
|
# returns main ractor
|
||||||
def self.main
|
def self.main
|
||||||
__builtin_cexpr! %q{
|
__builtin_cexpr! %q{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user