Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init: add pidlock for polymake initialization #487

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Polymake"
uuid = "d720cf60-89b5-51f5-aff5-213f193123e7"
repo = "https://github.com/oscar-system/Polymake.jl.git"
version = "0.11.16"
version = "0.11.17"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand All @@ -14,6 +14,7 @@ Mongoc = "4fe8b98c-fc19-5c23-8ec2-168ff83495f2"
NetworkOptions = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
Ninja_jll = "76642167-d241-5cee-8c94-7a494e8cb7b7"
Perl_jll = "83958c19-0796-5285-893e-a1267f8ec499"
Pidfile = "fa939f87-e72e-5be4-a000-7fc836dbe307"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
Expand All @@ -35,6 +36,7 @@ Mongoc = "~0.6.0, ~0.7.0, ~0.8.0, ~0.9.0"
NetworkOptions = "1.2"
Ninja_jll = "^1.11.1"
Perl_jll = "^5.34.0"
Pidfile = "^1.3"
Pkg = "^1.6"
REPL = "^1.6"
Scratch = "^1.1"
Expand Down
9 changes: 7 additions & 2 deletions src/Polymake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ using CxxWrap

using BinaryWrappers
using Scratch
import Pidfile

import Perl_jll
import Ninja_jll
Expand Down Expand Up @@ -188,6 +189,7 @@ function __init__()
Downloads.default_downloader!(Downloads.Downloader(grace=0.01))
end
# we run this on every init to make sure all artifacts still exist
# (this code should be race condition free even with multiple processes)
prepare_deps_tree(polymake_deps_tree)
@static if isdefined(Downloads, :default_downloader!)
# restore default
Expand Down Expand Up @@ -243,8 +245,11 @@ function __init__()
try
show_banner = should_show_banner() &&
!any(x->x.name in ["Oscar"], keys(Base.package_locks))

initialize_polymake_with_dir("$(polymake_extension_config);user=$(polymake_user_dir)", installtop, installarch, show_banner)
mkpath(polymake_user_dir)
# lock to avoid race-conditions when recompiling wrappers in multiple processes
Pidfile.mkpidlock("$(polymake_user_dir)/userdir.lock") do
initialize_polymake_with_dir("$(polymake_extension_config);user=$(polymake_user_dir)", installtop, installarch, show_banner)
end
if !show_banner
shell_execute(raw"$Verbose::credits=\"0\";")
end
Expand Down
Loading