diff --git a/Project.toml b/Project.toml index dbf49be..4a06f87 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/fft.jl b/src/fft.jl index e59342f..c3978ac 100644 --- a/src/fft.jl +++ b/src/fft.jl @@ -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 —