Skip to content

Commit

Permalink
Avoid synchronizing freed queues. (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt authored Oct 4, 2024
1 parent 5837ca6 commit 1358a43
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/cl/cmdqueue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ mutable struct CmdQueue <: CLObject
function CmdQueue(q_id::cl_command_queue; retain::Bool=false)
q = new(q_id)
retain && clRetainCommandQueue(q)
finalizer(clReleaseCommandQueue, q)
finalizer(q) do _
# this is to prevent `device_synchronize()` operating on freed queues.
# XXX: why does the WeakKeyDict contain freed objects?
delete!(cl.queues, q)
clReleaseCommandQueue(q)
end
return q
end
end
Expand Down

0 comments on commit 1358a43

Please sign in to comment.