Skip to content

Commit

Permalink
avoid timing race in async test
Browse files Browse the repository at this point in the history
This is the test from #27164.

The test was checking whether sleep(1) (which is started first) or
sleep(0.05) (which is nominally shorter) returned first. Switch the
order so that the short sleep should always end first.

Fixes #46360
  • Loading branch information
vtjnash committed Sep 28, 2022
1 parent 1afa368 commit 06d5d68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ do_something_async_27164() = @async(begin sleep(1); x27164[] = 2; end)

let t = nothing
@sync begin
t = do_something_async_27164()
@async (sleep(0.05); x27164[] = 1)
t = do_something_async_27164()
end
@test x27164[] == 1
fetch(t)
Expand Down

0 comments on commit 06d5d68

Please sign in to comment.