11module Cjl
22
33using ... C: C
4- using ... Utils: Utils, Lockable
4+ using ... Utils: Utils, Lockable, GLOBAL_LOCK
55using Base: @kwdef
66using UnsafePointers: UnsafePtr
77using 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 )))
19+ const PYJLVALUES = Lockable ((; values= IdDict {Int,Any} (), free_slots= Int[], next_slot= Ref (1 )), GLOBAL_LOCK )
2020
2121function _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
4040end
4141
42- const PYJLMETHODS = Lockable ([])
42+ const PYJLMETHODS = Lockable ([], GLOBAL_LOCK )
4343
4444function 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
6666end
6767
68- const PYJLBUFCACHE = Lockable (Dict {Ptr{Cvoid},Any} ())
68+ const PYJLBUFCACHE = Lockable (Dict {Ptr{Cvoid},Any} (), GLOBAL_LOCK )
6969
7070@kwdef struct PyBufferInfo{N}
7171 # data
0 commit comments