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

fix #52, bad ccall with julia v1.7 #53

Merged
merged 3 commits into from
Jun 30, 2021
Merged
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions src/lock.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ end

Base.unlock(nrl::NonReentrantLock) = unlock(nrl.rl)

if VERSION >= v"1.7.0-DEV"
# as of v1.7 locks in Base disable finalizers
enable_finalizers(on::Bool) = nothing
else
# NonReentrantLock may be taken around code that might call the GC, which might
# reenter through finalizers. Avoid that by temporarily disabling finalizers
# running concurrently on this thread.
enable_finalizers(on::Bool) = ccall(:jl_gc_enable_finalizers, Cvoid,
(Ptr{Cvoid}, Int32,), Core.getptls(), on)
end

macro safe_lock(l, ex)
quote
temp = $(esc(l))
Expand Down