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, I'm not sure if I'm doing this wrong, but the following code prints waiting forever and never exits. I'm guessing there is a deadlock somewhere, but I'm not sure.
require 'agent'
channel = channel!(Integer)
def read_channel
channel.receive
end
go! do
puts read_channel
channel.close
end
go! do
channel.send(1)
end
while not channel.closed? do
sleep 0.1
puts 'waiting'
end
puts 'done'
If I replace the function with a lambda instead, then it works fine, done is printed and the program exits. Do you know why this might be happening? Thank you for making this gem!
require 'agent'
channel = channel!(Integer)
read_channel = lambda do
channel.receive
end
go! do
puts read_channel.call
channel.close
end
go! do
channel.send(1)
end
while not channel.closed? do
sleep 0.1
puts 'waiting'
end
puts 'done'
The text was updated successfully, but these errors were encountered:
Hi, I'm not sure if I'm doing this wrong, but the following code prints waiting forever and never exits. I'm guessing there is a deadlock somewhere, but I'm not sure.
If I replace the function with a lambda instead, then it works fine, done is printed and the program exits. Do you know why this might be happening? Thank you for making this gem!
The text was updated successfully, but these errors were encountered: