sanei_thread.c: Use deferred cancellation mode

The change prevents hangs in projects who run scanimage in their unit tests in rapid speeds, such as perl-Image-Sane.

Without the patch, you can reproduce the issue with this command:

while true; do scanimage --verbose --device=test --batch-count=2; done

The command hangs after several iterations.

Merge request reports

Loading
Loading