Skip to content

Commit

Permalink
Merge pull request #487 from oscar-system/bl/pidlock
Browse files Browse the repository at this point in the history
init: add pidlock for polymake initialization
  • Loading branch information
benlorenz authored May 15, 2024
2 parents 5a52408 + 18bd373 commit 80daa74
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

2 comments on commit 80daa74

@benlorenz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator: register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/107053

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.17 -m "<description of version>" 80daa742cad63b6805be0a39fe8eb9ef1533dbbe
git push origin v0.11.17

Please sign in to comment.