Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deprecate GCond and GMutex compat layer #4249

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 2 commits into from
Mar 20, 2025

Conversation

kleisauke
Copy link
Member

@kleisauke kleisauke commented Nov 8, 2024

This PR migrates and deprecates the following functions in favor of their GLib equivalents:

  • vips_g_mutex_new() is replaced by g_mutex_init()
  • vips_g_mutex_free() is replaced by g_mutex_clear()
  • vips_g_cond_new() is replaced by g_cond_init()
  • vips_g_cond_free() is replaced by g_cond_clear()

Additionally, explicit calls to g_mutex_{init,clear}() have been removed for mutexes initialized in static storage, as this is only necessary for mutexes that are part of dynamically allocated structures. Edit: split to #4362.

Context: #4134 (comment).

The abi-compliance-checker results are available at:
https://kleisauke.nl/compat_reports/vips/master_to_deprecate-gcond-gmutex-compat-layer/compat_report.html

Marked as draft to investigate a potential ABI breakage in the public VipsSemaphore structure. Edit: fixed with commit 2a20e41.

@kleisauke

This comment was marked as resolved.

@kleisauke kleisauke changed the title Deprecate GCond and GMutex compat layer Deprecate GCond and GMutex compat layer Nov 8, 2024
@kleisauke kleisauke force-pushed the deprecate-gcond-gmutex-compat-layer branch from 7f3432e to 5b0f1e6 Compare November 9, 2024 09:26
Mizokuiam

This comment was marked as spam.

@kleisauke kleisauke force-pushed the deprecate-gcond-gmutex-compat-layer branch 2 times, most recently from ddb745e to 81575c6 Compare January 27, 2025 12:09
@kleisauke kleisauke force-pushed the deprecate-gcond-gmutex-compat-layer branch 2 times, most recently from 3af143b to 24a198a Compare February 2, 2025 15:00
@kleisauke
Copy link
Member Author

kleisauke commented Feb 2, 2025

Commit 2a20e41 ensures ABI compatibility for the public VipsSemaphore structure. The abi-compliance-checker result looks OK now:
https://kleisauke.nl/compat_reports/vips/master_to_deprecate-gcond-gmutex-compat-layer/compat_report.html

Changing `GCond *` to `GCond` in public structures would break ABI
compatibility, at least when building against GLib 2.x.

See: https://gitlab.gnome.org/GNOME/glib/-/issues/1256.
@kleisauke kleisauke force-pushed the deprecate-gcond-gmutex-compat-layer branch from 24a198a to 2a20e41 Compare March 17, 2025 14:38
Comment on lines +142 to +143
if (fits->line)
g_mutex_clear(&fits->lock);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't ideal. An alternative might be merging this with fitsload.c, but that is a much larger change.

@kleisauke kleisauke marked this pull request as ready for review March 17, 2025 15:27
@jcupitt
Copy link
Member

jcupitt commented Mar 18, 2025

This looks OK to me, well done for doing this horrible job.

I think the size of VipsSemaphore changing doesn't matter in practice since we don't document members and never allocate statically or on the stack (the API prevents that anyway), but I can see it's good to keep API checkers happy.

@kleisauke
Copy link
Member Author

I think the size of VipsSemaphore changing doesn't matter in practice since we don't document members and never allocate statically or on the stack (the API prevents that anyway), but I can see it's good to keep API checkers happy.

Ah, you're right. Though, we didn't mark these VipsSemaphore members previously as /*< private >*/, like we do in VipsArea. This PR adds that annotation.

How about a ping-pong strategy? We could land this PR as-is for 8.17 and then revert 2a20e41 in 8.18. This would hopefully appease the API/ABI checkers.

@jcupitt
Copy link
Member

jcupitt commented Mar 20, 2025

Sure, why not. OK to merge now?

@kleisauke
Copy link
Member Author

Sure, let's merge! :)

@jcupitt jcupitt merged commit 7e2b786 into libvips:master Mar 20, 2025
6 checks passed
@kleisauke kleisauke deleted the deprecate-gcond-gmutex-compat-layer branch March 20, 2025 13:36
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.

3 participants