Skip to content

threadpool: prefer use of dedicated GLib atomic operations #4123

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 1 commit into from
Sep 20, 2024

Conversation

kleisauke
Copy link
Member

@kleisauke kleisauke commented Aug 27, 2024

That is:
g_atomic_int_add(..., 1) -> g_atomic_int_inc(...)
g_atomic_int_add(..., -1) -> g_atomic_int_dec_and_test(...)

Additionally, turn the exit count into a proper flag, enabling the use of a single atomic compare-and-exchange operation that resets the flag only when it is set.

Should be considered as a non-functional change.

kleisauke added a commit to libvips/build-win64-mxe that referenced this pull request Aug 27, 2024
@kleisauke kleisauke marked this pull request as draft August 29, 2024 10:50
@kleisauke

This comment was marked as resolved.

@kleisauke kleisauke force-pushed the prefer-dedicated-glib-atomic-ops branch from d12db7a to 4a711f7 Compare August 29, 2024 14:38
That is:
`g_atomic_int_add(..., 1)` -> `g_atomic_int_inc(...)`
`g_atomic_int_add(..., -1)` -> `g_atomic_int_dec_and_test(...)`

Additionally, turn the exit count into a proper flag, enabling the
use of a single atomic compare-and-exchange operation that resets
the flag only when it is set.
@kleisauke kleisauke force-pushed the prefer-dedicated-glib-atomic-ops branch from 4a711f7 to 5ba5424 Compare September 1, 2024 13:23
@kleisauke kleisauke marked this pull request as ready for review September 1, 2024 13:24
@jcupitt
Copy link
Member

jcupitt commented Sep 20, 2024

Oooof sorry for the delay. Nice!

@jcupitt jcupitt merged commit 27229aa into libvips:master Sep 20, 2024
6 checks passed
@kleisauke kleisauke deleted the prefer-dedicated-glib-atomic-ops branch September 20, 2024 16:00
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.

2 participants