Skip to content

Fix the behavior of setCount in UnionFindSet when used concurrently #147

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
Apr 15, 2025

Conversation

jjppp
Copy link
Member

@jjppp jjppp commented Apr 15, 2025

The UnionFindSet is used concurrently in algorithms such as Mahjong and DFAEquivChecker. However, UnionFind is not thread-safe since the setCount variable in the UnionFindSet class is simply int instead of AtomicInteger.

This PR fixes the bug above by converting the type of setCount from int to AtomicInteger.

Copy link

github-actions bot commented Apr 15, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@codecov-commenter
Copy link

codecov-commenter commented Apr 15, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 71.93%. Comparing base (a8b3982) to head (bfb5b21).

Files with missing lines Patch % Lines
...java/pascal/taie/util/collection/UnionFindSet.java 0.00% 4 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #147      +/-   ##
============================================
- Coverage     71.95%   71.93%   -0.02%     
  Complexity     4365     4365              
============================================
  Files           479      479              
  Lines         15868    15869       +1     
  Branches       2179     2179              
============================================
- Hits          11418    11416       -2     
- Misses         3570     3574       +4     
+ Partials        880      879       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jjppp
Copy link
Member Author

jjppp commented Apr 15, 2025

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 15, 2025
@zhangt2333 zhangt2333 merged commit 2cef10c into pascal-lab:master Apr 15, 2025
4 of 5 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants