Mercurial > hg
view rust/hg-core/Cargo.toml @ 52217:96b113d22b34 stable
rust-update: handle SIGINT from long-running update threads
The current code does not respond to ^C until after the Rust bit is finished
doing its work. This is expected, since Rust holds the GIL for the duration
of the call and does not call `PyErr_CheckSignals`. Freeing the GIL to do our
work does not really improve anything since the Rust threads are still going,
and the only way of cancelling a thread is by making it cooperate.
So we do the following:
- remember the SIGINT handler in hg-cpython and reset it after the call
into core (see inline comment in `update.rs` about this)
- make all update threads watch for a global `AtomicBool` being `true`,
and if so stop their work
- reset the global bool and exit early (i.e. before writing the dirstate)
- raise SIGINT from `hg-cpython` if update returns `InterruptReceived`
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 12 Nov 2024 12:52:13 +0100 |
parents | 8b7123c8947b |
children | 65d516db7309 |
line wrap: on
line source
[package] name = "hg-core" version = "0.1.0" authors = ["Georges Racinet <gracinet@anybox.fr>"] description = "Mercurial pure Rust core library, with no assumption on Python bindings (FFI)" edition = "2021" [lib] name = "hg" [dependencies] bitflags = "1.3.2" bytes-cast = "0.3.0" byteorder = "1.4.3" ctrlc = "3.4" derive_more = "0.99.17" hashbrown = { version = "0.13.1", features = ["rayon"] } home = "0.5.4" im-rc = "15.1.0" indicatif = "0.17.8" itertools = "0.10.5" lazy_static = "1.4.0" libc = "0.2.137" logging_timer = "1.1.0" rand = "0.8.5" rand_pcg = "0.3.1" rand_distr = "0.4.3" rayon = "1.7.0" regex = "1.7.0" self_cell = "1.0" serde = { version = "1.0", features = ["derive"] } sha-1 = "0.10.0" twox-hash = "1.6.3" same-file = "1.0.6" tempfile = "3.3.0" toml = "0.6" thread_local = "1.1.4" crossbeam-channel = "0.5.6" log = "0.4.17" memmap2 = { version = "0.5.8", features = ["stable_deref_trait"] } zstd = "0.12" format-bytes = "0.3.0" once_cell = "1.16.0" bitvec = "1.0.1" chrono = "0.4.34" dyn-clone = "1.0.16" filetime = "0.2.23" uuid = { version = "1.10", features = ["v4"] } # We don't use the `miniz-oxide` backend to not change rhg benchmarks and until # we have a clearer view of which backend is the fastest. [dependencies.flate2] version = "1.0.24" features = ["zlib"] default-features = false [dev-dependencies] clap = { version = "~4.0", features = ["derive"] } pretty_assertions = "1.1.0"