Skip to content

add vips__worker_exit #4601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 11, 2025
Merged

add vips__worker_exit #4601

merged 3 commits into from
Jul 11, 2025

Conversation

jcupitt
Copy link
Member

@jcupitt jcupitt commented Jul 6, 2025

In interactive applications it's important to be able to shut down pipelines which are no longer needed as quickly as possible.

Right now, shutdown can be very slow. For example, vips_subsample() on a large image can maybe take 1 or 2 seconds per tile, so it can take 1 or 2 seconds between the start of shutdown and the exit of any threads. If the user is updating the operation graph faster than that, pipelines will start to back up and the system will lag badly.

This PR adds vips__worker_exit(), a fast test-for-shutdown that operations can call in their generate function.

It adds vips__worker_exit() to vips_subsample() and successfully stops pipelines lagging for nip4 previews. Some other slow operations should probably have calls added too (shrink, reduce, conv, perhaps others), but they can be added later as required.

jcupitt added 3 commits July 6, 2025 13:48
In interactive applications it's important to be able to shut down
pipelines which are no longer needed as quickly as possible.

Right now, shutdown can be very slow. For example, vips_subsample() on a
large image can maybe take 1 or 2 seconds per tile, so it can take 1 or
2 seconds between the start of shutdown and the exit of any threads. If
the user is updating the operation graph faster than that, pipelines
will start to back up and the system will lag badly.

This PR adds vips__worker_exit(), a fast test-for-shutdown that
operations can call in their generate function.

It adds vips__worker_exit() to vips_subsample() and successfully stops
pipelines lagging for nip4 previews. Some other slow operations should
probably have calls added too (shrink, reduce, conv, perhaps others),
but they can be added later as required.
@jcupitt jcupitt merged commit cc5e049 into master Jul 11, 2025
13 checks passed
@jcupitt jcupitt deleted the add-vips__worker_exit branch July 11, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant