You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for the library! I'm not sure if you're still maintaining this, but if you are, I've noticed what seems to be a problem with the function version of @select.
A somewhat minimal script below reproduces to problem for me:
using Select
ch1 = Channel{Int64}()
ch2 = Channel{Float64}()
@async begin
for i in 1:10
put!(ch1, i)
sleep(1)
end
end
@async begin
for i in 1:10
put!(ch2, i * 1.0)
sleep(1)
end
end
# Switch the order -- the second clause seems to always receive nothing.
clauses = [(:take, ch1), (:take, ch2)]
# clauses = [(:take, ch2), (:take, ch1)]
while true
idx, val = Select.select(clauses)
println("Received value of type $(typeof(val))")
end
# The macro form always works, though
# while true
# @select begin
# ch1 |> val => println("Received value of type $(typeof(val))")
# ch2 |> val => println("Received value of type $(typeof(val))")
# end
# end
If I run this, I get this error
Received value of type Int64
ERROR: LoadError: TypeError: in typeassert, expected Float64, got a value of type Nothing
It always seems to be sending nothing to the second channel, though. If you switch the order of the clauses, I get
Received value of type Float64
ERROR: LoadError: TypeError: in typeassert, expected Int64, got a value of type Nothing
The macro always seems to work, though!
I realize this library is one of many attempts to get this go-like select statements into the standard library (or core?) so if you've moved on from this, all good! I've tried to read up on the source to understand what was going on and to provide a fix, but it's a bit more than I can chew at the moment.
The text was updated successfully, but these errors were encountered:
👍 Thanks! Yeah, unfortunately this package is dead. @Vtjnash and others in this thread: JuliaLang/julia#13763 have pointed out that @select as a concurrency primitive has a number of issues, and that it would be better for user code to avoid it.
So far I have found that I'm actually able to write decent programs without it, usually using a Channel instead...
So yeah, this was only ever an experiment, and we aren't using it at all 👍 i'll add a note to the README to hopefully make that clearer!
Hi, thanks for the library! I'm not sure if you're still maintaining this, but if you are, I've noticed what seems to be a problem with the function version of
@select
.A somewhat minimal script below reproduces to problem for me:
If I run this, I get this error
It always seems to be sending
nothing
to the second channel, though. If you switch the order of the clauses, I getThe macro always seems to work, though!
I realize this library is one of many attempts to get this go-like select statements into the standard library (or core?) so if you've moved on from this, all good! I've tried to read up on the source to understand what was going on and to provide a fix, but it's a bit more than I can chew at the moment.
The text was updated successfully, but these errors were encountered: