diff --git a/src/Curl/Multi.jl b/src/Curl/Multi.jl index ccf50d3..f372874 100644 --- a/src/Curl/Multi.jl +++ b/src/Curl/Multi.jl @@ -8,7 +8,12 @@ mutable struct Multi function Multi(grace::Integer = typemax(UInt64)) multi = new(ReentrantLock(), C_NULL, nothing, Easy[], grace) finalizer(done!, multi) - @lock MULTIS_LOCK push!(MULTIS, WeakRef(multi)) + lock(MULTIS_LOCK) + try + push!(MULTIS, WeakRef(multi)) + catch + unlock(MULTIS_LOCK) + end return multi end end