mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Ractor#take
and warn
`Ractor#take` was deprecated but some libraries can use it as an alias for `Ractor#value` (i.e., to wait for a Ractor's temrination and retrieve its result). Therefore `Ractor#take` is simply an alias for `Ractor#value`. This method will remain available until the end of August 2025, unless there is further discussion.
This commit is contained in:
parent
9fddb8d954
commit
8070d5d97d
Notes:
git
2025-06-04 10:18:31 +00:00
2 changed files with 22 additions and 0 deletions
|
@ -2211,3 +2211,19 @@ assert_equal '[["Only the successor ractor can take a value", 9], ["ok", 2]]', %
|
|||
Ractor.receive
|
||||
}.tally.sort
|
||||
}
|
||||
|
||||
# Ractor#take will warn for compatibility.
|
||||
# This method will be removed after 2025/09/01
|
||||
assert_equal "2", %q{
|
||||
raise "remove Ractor#take and this test" if Time.now > Time.new(2025, 9, 2)
|
||||
$VERBOSE = true
|
||||
r = Ractor.new{42}
|
||||
$msg = []
|
||||
def Warning.warn(msg)
|
||||
$msg << msg
|
||||
end
|
||||
r.take
|
||||
r.take
|
||||
raise unless $msg.all?{/Ractor#take/ =~ it}
|
||||
$msg.size
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue