Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a safepoint in the maybe_destroy_plan spin lock #205

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FFTW"
uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
version = "1.4.1"
version = "1.4.2"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
6 changes: 5 additions & 1 deletion src/fft.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ function maybe_destroy_plan(plan::FFTWPlan)
# since task switches aren't permitted in finalizers. This has suboptimal efficiency,
# but we shouldn't waste too many cycles since destroying plans is quick and contention
# should be rare.
while !trylock(deferred_destroy_lock); end
while !trylock(deferred_destroy_lock)
# Need a safepoint in here because without it, this loop blocks forward progress in the GC and can deadlock
# the program.
GC.safepoint()
end
try
# note: fftwlock is re-entrant, so trylock will succeed here if we
# are in the task that holds the planner lock. That's okay — 
Expand Down