kornelski / cavif-rs

AVIF image creator in pure Rust
https://lib.rs/cavif
BSD 3-Clause "New" or "Revised" License
570 stars 27 forks source link

How to handle ThreadPoolBuildError when calling cavif command #57

Open Dzhami-Jame-ALI opened 2 years ago

Dzhami-Jame-ALI commented 2 years ago

Hi, I am using a multiprocess script to call cavif command (I am not using option --threads). I found that when I increase the process number, some errors appear like:

thread 'main' panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }) }'
thread 'main' panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }) }'
...

Such error won't appear if I use single-process program or 2~3 multi-processes program. I have tried both pre-built version and self cargo installed version. Is there a way to prevent this?

kornelski commented 2 years ago

@Szpadel can you help with this?