Skip to content

Commit

Permalink
fix Event to use normal Condition variable (#55441)
Browse files Browse the repository at this point in the history
ThreadSynchronizer is only for things that are very trivial, as there
are a lot of things they are forbidden from doing (such as waiting for a
Task to set it).

Happened to notice while reviewing
#55439 (review)
that this was still using the pre-v1.2 style lock, which makes this
mostly useless in v1.4+

(cherry picked from commit 2a4e2b1)
  • Loading branch information
vtjnash authored and KristofferC committed Aug 19, 2024
1 parent 89faa35 commit 63c8445
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/lock.jl
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,10 @@ This provides an acquire & release memory ordering on notify/wait.
The `autoreset` functionality and memory ordering guarantee requires at least Julia 1.8.
"""
mutable struct Event
const notify::ThreadSynchronizer
const notify::Threads.Condition
const autoreset::Bool
@atomic set::Bool
Event(autoreset::Bool=false) = new(ThreadSynchronizer(), autoreset, false)
Event(autoreset::Bool=false) = new(Threads.Condition(), autoreset, false)
end

function wait(e::Event)
Expand Down

0 comments on commit 63c8445

Please sign in to comment.