Skip to content

Commit b620562

Browse files
KristofferCKristofferC
andauthored
add a lock when mutating PkgInfo (#4394)
Co-authored-by: KristofferC <[email protected]>
1 parent 733f6d8 commit b620562

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Registry/registry_instance.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ struct PkgInfo
6262

6363
# WeakDeps.toml
6464
weak_deps::Dict{VersionRange, Dict{String, UUID}}
65+
66+
info_lock::ReentrantLock
6567
end
6668

6769
isyanked(pkg::PkgInfo, v::VersionNumber) = pkg.version_info[v].yanked
@@ -155,15 +157,15 @@ function initialize_weak_uncompressed!(pkg::PkgInfo, versions = keys(pkg.version
155157
end
156158

157159
function compat_info(pkg::PkgInfo)
158-
initialize_uncompressed!(pkg)
160+
@lock pkg.info_lock initialize_uncompressed!(pkg)
159161
return Dict(v => info.uncompressed_compat for (v, info) in pkg.version_info)
160162
end
161163

162164
function weak_compat_info(pkg::PkgInfo)
163165
if isempty(pkg.weak_deps)
164166
return nothing
165167
end
166-
initialize_weak_uncompressed!(pkg)
168+
@lock pkg.info_lock initialize_weak_uncompressed!(pkg)
167169
return Dict(v => info.weak_uncompressed_compat for (v, info) in pkg.version_info)
168170
end
169171

@@ -254,7 +256,7 @@ function init_package_info!(pkg::PkgEntry)
254256
end
255257

256258
@assert !isdefined(pkg, :info)
257-
pkg.info = PkgInfo(repo, subdir, version_info, compat, deps, weak_compat, weak_deps)
259+
pkg.info = PkgInfo(repo, subdir, version_info, compat, deps, weak_compat, weak_deps, pkg.info_lock)
258260

259261
return pkg.info
260262
end

0 commit comments

Comments
 (0)