instance method · added in Ruby 4.0
Ractor#value
() -> untyped
ractor.value → obj
ractor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ractor.rb, line 611
def value
self.join
__builtin_ractor_value
end
Waits for ractor to complete and returns its value or raises the exception which terminated the Ractor. The termination value will be moved to the calling Ractor. Therefore, at most 1 Ractor can receive another ractor’s termination value.
Example
r = Ractor.new{ [1, 2] } r.value #=> [1, 2] (unshareable object) Ractor.new(r){|r| r.value} #=> Ractor::Error
Ruby version changes
-
4.0
-
Ractor#joinandRactor#valuewere added to wait for the termination of aRactor. These are similar toThread#joinandThread#value.
-