Skip to content

Commit d798710

Browse files
committed
Revert "add global locking utility"
This reverts commit c05a22f.
1 parent 95d9e41 commit d798710

File tree

7 files changed

+11
-14
lines changed

7 files changed

+11
-14
lines changed

src/Convert/Convert.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ using ..Core:
1010
C,
1111
Utils,
1212
Lockable,
13-
GLOBAL_LOCK,
1413
@autopy,
1514
getptr,
1615
incref,

src/Convert/pyconvert.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ struct PyConvertRule
1212
priority::PyConvertPriority
1313
end
1414

15-
const PYCONVERT_RULES = Lockable(Dict{String,Vector{PyConvertRule}}(), GLOBAL_LOCK)
16-
const PYCONVERT_EXTRATYPES = Lockable(Py[], GLOBAL_LOCK)
15+
const PYCONVERT_RULES = Lockable(Dict{String,Vector{PyConvertRule}}())
16+
const PYCONVERT_EXTRATYPES = Lockable(Py[])
1717

1818
"""
1919
pyconvert_add_rule(tname::String, T::Type, func::Function, priority::PyConvertPriority=PYCONVERT_PRIORITY_NORMAL)
@@ -261,7 +261,7 @@ function _pyconvert_get_rules(pytype::Py)
261261
return rules
262262
end
263263

264-
const PYCONVERT_PREFERRED_TYPE = Lockable(Dict{Py,Type}(), GLOBAL_LOCK)
264+
const PYCONVERT_PREFERRED_TYPE = Lockable(Dict{Py,Type}())
265265

266266
pyconvert_preferred_type(pytype::Py) =
267267
Base.@lock PYCONVERT_PREFERRED_TYPE get!(PYCONVERT_PREFERRED_TYPE[], pytype) do
@@ -307,7 +307,7 @@ end
307307

308308
pyconvert_fix(::Type{T}, func) where {T} = x -> func(T, x)
309309

310-
const PYCONVERT_RULES_CACHE = Lockable(IdDict{Any,Dict{C.PyPtr,Vector{Function}}}(), GLOBAL_LOCK)
310+
const PYCONVERT_RULES_CACHE = Lockable(IdDict{Any,Dict{C.PyPtr,Vector{Function}}}())
311311

312312
function pyconvert_rules_cache(::Type{T}) where {T}
313313
Base.@lock PYCONVERT_RULES_CACHE get!(

src/Core/Core.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const ROOT_DIR = dirname(dirname(@__DIR__))
1111
using ..PythonCall: PythonCall # needed for docstring cross-refs
1212
using ..C: C
1313
using ..GC: GC
14-
using ..Utils: Utils, Lockable, GLOBAL_LOCK
14+
using ..Utils: Utils, Lockable
1515
using Base: @propagate_inbounds, @kwdef
1616
using Dates:
1717
Date,

src/Core/Py.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ decref(x::Py) = Base.GC.@preserve x (decref(getptr(x)); x)
5656

5757
Base.unsafe_convert(::Type{C.PyPtr}, x::Py) = getptr(x)
5858

59-
const PYNULL_CACHE = Lockable(Py[], GLOBAL_LOCK)
59+
const PYNULL_CACHE = Lockable(Py[])
6060

6161
"""
6262
pynew([ptr])

src/Core/builtins.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ export pyfraction
12061206

12071207
### eval/exec
12081208

1209-
const MODULE_GLOBALS = Lockable(Dict{Module,Py}(), GLOBAL_LOCK)
1209+
const MODULE_GLOBALS = Lockable(Dict{Module,Py}())
12101210

12111211
function _pyeval_args(code, globals, locals)
12121212
if code isa AbstractString

src/JlWrap/C.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Cjl
22

33
using ...C: C
4-
using ...Utils: Utils, Lockable, GLOBAL_LOCK
4+
using ...Utils: Utils, Lockable
55
using Base: @kwdef
66
using UnsafePointers: UnsafePtr
77
using Serialization: serialize, deserialize
@@ -16,7 +16,7 @@ const PyJuliaBase_Type = Ref(C.PyNULL)
1616

1717
# we store the actual julia values here
1818
# the `value` field of `PyJuliaValueObject` indexes into here
19-
const PYJLVALUES = Lockable((; values=IdDict{Int,Any}(), free_slots=Int[], next_slot=Ref(1)), GLOBAL_LOCK)
19+
const PYJLVALUES = Lockable((; values=IdDict{Int,Any}(), free_slots=Int[], next_slot=Ref(1)))
2020

2121
function _pyjl_new(t::C.PyPtr, ::C.PyPtr, ::C.PyPtr)
2222
o = ccall(UnsafePtr{C.PyTypeObject}(t).alloc[!], C.PyPtr, (C.PyPtr, C.Py_ssize_t), t, 0)
@@ -39,7 +39,7 @@ function _pyjl_dealloc(o::C.PyPtr)
3939
nothing
4040
end
4141

42-
const PYJLMETHODS = Lockable([], GLOBAL_LOCK)
42+
const PYJLMETHODS = Lockable([])
4343

4444
function PyJulia_MethodNum(f)
4545
@nospecialize f
@@ -65,7 +65,7 @@ function _pyjl_callmethod(o::C.PyPtr, args::C.PyPtr)
6565
return _pyjl_callmethod(f, o, args, nargs)::C.PyPtr
6666
end
6767

68-
const PYJLBUFCACHE = Lockable(Dict{Ptr{Cvoid},Any}(), GLOBAL_LOCK)
68+
const PYJLBUFCACHE = Lockable(Dict{Ptr{Cvoid},Any}())
6969

7070
@kwdef struct PyBufferInfo{N}
7171
# data

src/Utils/Utils.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,4 @@ else
334334
const Lockable = Base.Lockable
335335
end
336336

337-
const GLOBAL_LOCK = ReentrantLock()
338-
339337
end

0 commit comments

Comments
 (0)