Skip to content

Commit 2f795dc

Browse files
committed
Do not lock on __init__
1 parent beea5f2 commit 2f795dc

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ dist/
77
.CondaPkg/
88
/jltest.*
99
uv.lock
10+
11+
# pixi environments
12+
.pixi
13+
*.egg-info

src/GIL/GIL.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,14 @@ macro unlock(expr)
160160
end
161161
end
162162

163+
#=
164+
# Disable this for now since holding this lock will disable finalizers
163165
# If the main thread already has the GIL, we should lock _jl_gil_lock.
164166
function __init__()
165167
if hasgil()
166168
Base.lock(_jl_gil_lock)
167169
end
168170
end
171+
=#
169172

170173
end

test/GC.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ end
2929
GC.gc()
3030

3131
# Unlock and relocking the ReentrantLock allows this test to pass
32-
Base.unlock(PythonCall.GIL._jl_gil_lock)
33-
Base.lock(PythonCall.GIL._jl_gil_lock)
32+
# if _jl_gil_lock is locked on init
33+
# Base.unlock(PythonCall.GIL._jl_gil_lock)
34+
# Base.lock(PythonCall.GIL._jl_gil_lock)
3435

3536
@test isempty(PythonCall.GC.QUEUE.items)
3637
end

0 commit comments

Comments
 (0)