diff options
| author | jakka <jakkadoujin@gmail.com> | 2025-07-07 13:18:57 +0300 |
|---|---|---|
| committer | jakka <jakkadoujin@gmail.com> | 2025-07-07 13:18:57 +0300 |
| commit | fccc22cd4a4a84211d8b61cf561d0f4463f500f1 (patch) | |
| tree | d36b9ae813a8217cb3cd723223c2c6bd59075cbb /src/main.rs | |
| parent | c8c1c4daa8579fe0462bdbd8f5437cca78d3348e (diff) | |
better threading handling
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index d1e4562..122ce60 100644 --- a/src/main.rs +++ b/src/main.rs @@ -116,7 +116,11 @@ fn main() -> Result<()> { if args.get_flag("doit") { let hanlder = running.clone(); let threads = *args.get_one::<usize>("threads").unwrap(); - files::reencode_files(conn, hanlder, threads)?; + let pool = rayon::ThreadPoolBuilder::new() + .num_threads(threads) + .build()?; + + pool.install(|| files::reencode_files(conn, hanlder))?; } Ok::<(), anyhow::Error>(()) } |
