Skip to content

Conversation

deckarep
Copy link
Owner

@deckarep deckarep commented Jun 6, 2025

  • Ensures the read lock is still unlocked if a panic occurs within the callback of the Each function and a recovery handler runs.
  • Fixes the capacity hint in ToSlice by ensuring the Cardinality is read under the confines of the read lock.
  • Adds a unit test

…this will ensure that the thread-safe set is left in a usable state by ensuring the read lock is Unlocked. This also has a minor tweak on ToSlice to ensure the capacity hint is correct
@deckarep deckarep changed the title Deadlock: if the callback on Each panics and the app has a recovery - issue: https://github.com/deckarep/golang-set/issues/163 Deadlock: if the callback on Each panics and the app has a recovery - issue 163 Jun 6, 2025
Copy link

@hemflit hemflit left a comment

Choose a reason for hiding this comment

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

Thank you for this quick resolution, and I'm sorry about the delay in getting back.

The production code LGTM 100%, it's just for the test code that I have one minor request for change and one recommendation.

@deckarep deckarep merged commit 9480c3e into main Jun 10, 2025
30 checks passed
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