Skip to content

Commit

Permalink
Ensure sending fiber finished in select specs (#8724)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian J. Cardiff committed Jan 31, 2020
1 parent c272b20 commit 7fc7379
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions spec/std/concurrent/select_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe "select" do
ch3 = Channel(Int32).new
x = nil

spawn do
f = spawn do
select
when x = ch1.receive
when x = ch2.receive
Expand All @@ -128,7 +128,9 @@ describe "select" do
end

ch3.receive.should eq(3)
Fiber.yield
until f.dead?
Fiber.yield
end
x.should eq(1)
end

Expand All @@ -138,7 +140,7 @@ describe "select" do
ch3 = Channel(Int32).new
x = nil

spawn do
f = spawn do
select
when ch1.send 1
x = 1
Expand All @@ -154,7 +156,9 @@ describe "select" do
end

ch3.receive.should eq(3)
Fiber.yield
until f.dead?
Fiber.yield
end
x.should eq(1)
end

Expand Down

0 comments on commit 7fc7379

Please sign in to comment.