diff options
| author | Sébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com> | 2024-09-26 11:02:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-26 09:02:44 +0000 |
| commit | 8d38bd406669dacb1c9819f92a94fda2178dc452 (patch) | |
| tree | a44aff07f2bdbf6190feb6e8838ced95752843ee | |
| parent | 59d65bbdc07f815610526d10373cc9d73e69668c (diff) | |
Single thread support (#4988)
| -rw-r--r-- | crates/typst-cli/src/args.rs | 2 | ||||
| -rw-r--r-- | crates/typst-cli/src/world.rs | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/crates/typst-cli/src/args.rs b/crates/typst-cli/src/args.rs index 5ec56555..49761d8f 100644 --- a/crates/typst-cli/src/args.rs +++ b/crates/typst-cli/src/args.rs @@ -225,7 +225,7 @@ pub struct SharedArgs { pub package_storage_args: PackageStorageArgs, /// Number of parallel jobs spawned during compilation, - /// defaults to number of CPUs. + /// defaults to number of CPUs. Setting it to 1 disables parallelism. #[clap(long, short)] pub jobs: Option<usize>, } diff --git a/crates/typst-cli/src/world.rs b/crates/typst-cli/src/world.rs index 7cec4101..bb491c02 100644 --- a/crates/typst-cli/src/world.rs +++ b/crates/typst-cli/src/world.rs @@ -60,7 +60,11 @@ impl SystemWorld { pub fn new(command: &SharedArgs) -> Result<Self, WorldCreationError> { // Set up the thread pool. if let Some(jobs) = command.jobs { - rayon::ThreadPoolBuilder::new().num_threads(jobs).build_global().ok(); + rayon::ThreadPoolBuilder::new() + .num_threads(jobs) + .use_current_thread() + .build_global() + .ok(); } // Resolve the system-global input path. |
