Skip to content

Commit

Permalink
Return :timed_out instead of :timeout like Base.timedwait
Browse files Browse the repository at this point in the history
  • Loading branch information
kpamnany committed Jan 10, 2025
1 parent 0d2c642 commit ee1a4cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions base/condition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ If the keyword `first` is set to `true`, the waiter will be put _first_
in line to wake up on `notify`. Otherwise, `wait` has first-in-first-out (FIFO) behavior.
If `timeout` is specified, cancel the `wait` when it expires and return
`:timeout`. The minimum value for `timeout` is 0.001 seconds, i.e. 1
`:timed_out`. The minimum value for `timeout` is 0.001 seconds, i.e. 1
millisecond.
"""
function wait(c::GenericCondition; first::Bool=false, timeout::Real=0.0)
Expand Down Expand Up @@ -167,7 +167,7 @@ function wait(c::GenericCondition; first::Bool=false, timeout::Real=0.0)
end
unlock(c.lock)
# send the waiting task a timeout
dosched && schedule(ct, :timeout)
dosched && schedule(ct, :timed_out)
end
t.sticky = false
Threads._spawn_set_thrpool(t, :interactive)
Expand Down
2 changes: 1 addition & 1 deletion test/channels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ end
@testset "timed wait on Condition" begin
a = Threads.Condition()
@test_throws ArgumentError @lock a wait(a; timeout=0.0005)
@test @lock a wait(a; timeout=0.1)==:timeout
@test @lock a wait(a; timeout=0.1)==:timed_out
lock(a)
@spawn begin
@lock a notify(a)
Expand Down

0 comments on commit ee1a4cb

Please sign in to comment.