Skip to content

Conversation

@j2rong4cn
Copy link
Member

@j2rong4cn j2rong4cn commented Sep 30, 2025

无锁线程安全的SyncClosers最终版本
Close方法的竟态从n次优化到最多2次

@j2rong4cn

This comment was marked as outdated.

@j2rong4cn j2rong4cn marked this pull request as draft September 30, 2025 16:17
@j2rong4cn j2rong4cn force-pushed the pr/fix7 branch 2 times, most recently from 2206fa8 to 37852f7 Compare October 1, 2025 01:44
@j2rong4cn j2rong4cn changed the title fix(sync-closers): replace atomic operations with mutex fix(sync-closers): improve Close method Oct 1, 2025
@j2rong4cn j2rong4cn requested a review from Copilot October 1, 2025 01:51
@j2rong4cn j2rong4cn marked this pull request as ready for review October 1, 2025 01:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the Close method in the SyncClosers type by simplifying the atomic reference counting logic and removing a compare-and-swap loop.

  • Replaces a complex compare-and-swap loop with a single atomic decrement operation
  • Improves logging to distinguish between reference releases and final closes
  • Simplifies the control flow for determining when to perform the final close operation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@j2rong4cn
Copy link
Member Author

最终方案,已经没优化空间了

@j2rong4cn j2rong4cn requested a review from Copilot October 1, 2025 02:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: j2rong4cn <[email protected]>
@j2rong4cn j2rong4cn changed the title fix(sync-closers): improve Close method perf(sync-closers): improve Close method Oct 1, 2025
@j2rong4cn j2rong4cn merged commit c3c7983 into OpenListTeam:main Oct 1, 2025
12 checks passed
@j2rong4cn
Copy link
Member Author

ai误我,ai建议我选择AcquireReference竟态的版本,😅

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