mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Ractor.select requires an argument or yield_value
This commit is contained in:
parent
c2fa024e02
commit
53ce71b5af
Notes:
git
2020-12-07 16:21:38 +09:00
2 changed files with 11 additions and 0 deletions
|
@ -163,6 +163,15 @@ assert_equal 30.times.map { 'ok' }.to_s, %q{
|
||||||
}
|
}
|
||||||
} unless ENV['RUN_OPTS'] =~ /--jit-min-calls=5/ # This always fails with --jit-wait --jit-min-calls=5
|
} unless ENV['RUN_OPTS'] =~ /--jit-min-calls=5/ # This always fails with --jit-wait --jit-min-calls=5
|
||||||
|
|
||||||
|
# Exception for empty select
|
||||||
|
assert_match /specify at least one ractor/, %q{
|
||||||
|
begin
|
||||||
|
Ractor.select
|
||||||
|
rescue ArgumentError => e
|
||||||
|
e.message
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
# Outgoing port of a ractor will be closed when the Ractor is terminated.
|
# Outgoing port of a ractor will be closed when the Ractor is terminated.
|
||||||
assert_equal 'ok', %q{
|
assert_equal 'ok', %q{
|
||||||
r = Ractor.new do
|
r = Ractor.new do
|
||||||
|
|
|
@ -71,6 +71,8 @@ class Ractor
|
||||||
# # and r is :yield
|
# # and r is :yield
|
||||||
#
|
#
|
||||||
def self.select(*ractors, yield_value: yield_unspecified = true, move: false)
|
def self.select(*ractors, yield_value: yield_unspecified = true, move: false)
|
||||||
|
raise ArgumentError, 'specify at least one ractor or `yield_value`' if yield_unspecified && ractors.empty?
|
||||||
|
|
||||||
__builtin_cstmt! %q{
|
__builtin_cstmt! %q{
|
||||||
const VALUE *rs = RARRAY_CONST_PTR_TRANSIENT(ractors);
|
const VALUE *rs = RARRAY_CONST_PTR_TRANSIENT(ractors);
|
||||||
VALUE rv;
|
VALUE rv;
|
||||||
|
|
Loading…
Reference in a new issue