Skip to content

Commit

Permalink
move lock to cachefile (ignoring prefs)
Browse files Browse the repository at this point in the history
Update base/loading.jl

Update loading.jl
  • Loading branch information
IanButterworth committed Jun 19, 2023
1 parent 90521dd commit 779acf7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2819,10 +2819,15 @@ global mkpidlock_hook
global trymkpidlock_hook
global parse_pidfile_hook

# The preferences hash is only known after precompilation so just assume no preferences
# meaning that if all other conditions are equal, the same package cannot be precompiled
# with different preferences at the same time.
compilecache_pidfile_path(pkg::PkgId) = compilecache_path(pkg, UInt64(0)) * ".pidfile"

# allows processes to wait if another process is precompiling a given source already
function maybe_cachefile_lock(f, pkg::PkgId, srcpath::String)
if @isdefined(mkpidlock_hook) && @isdefined(trymkpidlock_hook) && @isdefined(parse_pidfile_hook)
pidfile = string(srcpath, ".pidlock")
pidfile = compilecache_pidfile_path(pkg)
cachefile = invokelatest(trymkpidlock_hook, f, pidfile)
if cachefile === false
pid, hostname, age = invokelatest(parse_pidfile_hook, pidfile)
Expand Down

0 comments on commit 779acf7

Please sign in to comment.