Skip to content

Commit

Permalink
Add a safepoint in the maybe_destroy_plan spin lock (#205)
Browse files Browse the repository at this point in the history
* Add a safepoint in the maybe_destroy_plan spin lock

* Fix typo
  • Loading branch information
Octogonapus committed Jun 8, 2021
1 parent e0bc05a commit df8f937
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

2 comments on commit df8f937

@stevengj
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/38442

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.4.2 -m "<description of version>" df8f93772dc10a047e1205af470751058f805c3c
git push origin v1.4.2

Please sign in to comment.