rust/rhg/src/main.rs
branchstable
changeset 50321 14b57943ae6d
parent 50004 fba29deebfe7
child 50803 8ff187fbbfea
--- a/rust/rhg/src/main.rs	Wed Mar 22 17:18:32 2023 +0000
+++ b/rust/rhg/src/main.rs	Thu Mar 23 19:10:15 2023 +0100
@@ -140,6 +140,13 @@
 
     env_logger::init();
 
+    // Make sure nothing in a future version of `rhg` sets the global
+    // threadpool before we can cap default threads. (This is also called
+    // in core because Python uses the same code path, we're adding a
+    // redundant check.)
+    hg::utils::cap_default_rayon_threads()
+        .expect("Rayon threadpool already initialized");
+
     let early_args = EarlyArgs::parse(&argv);
 
     let initial_current_dir = early_args.cwd.map(|cwd| {