Skip to content

Commit

Permalink
double-check that package is precompiled after waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jun 20, 2023
1 parent 7cda8fe commit 29281d0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1595,9 +1595,17 @@ function maybe_cachefile_lock(f, pkg::Base.PkgId, srcpath::String, pkgspidlocked
else
"machine (hostname: $hostname, pid: $pid)"
end
# wait until the lock is available, but don't actually acquire it
# returning nothing indicates a process waited for another
return FileWatching.mkpidlock(Returns(nothing), pidfile)
# wait until the lock is available
FileWatching.mkpidlock(pidfile) do
# double-check in case the other process crashed or the lock expired
if Base.isprecompiled(pkg)
# returning nothing indicates a process waited for another
return nothing
else
delete!(pkgspidlocked, pkg)
return f()
end
end
end
return cachefile
end
Expand Down

0 comments on commit 29281d0

Please sign in to comment.