File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -275,10 +275,6 @@ unsafe_destroy_plan(plan::FFTWPlan{<:fftwSingle}) =
275275const deferred_destroy_lock = ReentrantLock () # lock protecting the deferred_destroy_plans list
276276const deferred_destroy_plans = FFTWPlan[]
277277
278- # hack to get non-reentrant lock, which is necessary to ensure that GC running in the
279- # same task that acquired fftwlock will use deferred_destroy_plans in maybe_destroy_plan.
280- trylock_nonreentrant (rl:: ReentrantLock ) = current_task () != = rl. locked_by && trylock (rl)
281-
282278function destroy_deferred ()
283279 lock (deferred_destroy_lock)
284280 try
@@ -306,7 +302,11 @@ function maybe_destroy_plan(plan::FFTWPlan)
306302 # then we push a deferred plan that may never get freed)
307303 lock (deferred_destroy_lock)
308304 try
309- if trylock_nonreentrant (fftwlock)
305+ # note: fftwlock is re-entrant, so trylock will succeed here if we
306+ # are in the task that holds the planner lock. That's okay —
307+ # re-entrant calls to destroy_plan in the planner thread
308+ # should be fine as long as we didn't call make_planner_thread_safe.
309+ if trylock (fftwlock)
310310 try
311311 unsafe_destroy_plan (plan)
312312 finally
You can’t perform that action at this time.
0 commit comments