- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.4k
 
perf(sync-closers): improve Close method #1395
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
Conversation
      
        
              This comment was marked as outdated.
        
        
      
    
  This comment was marked as outdated.
2206fa8    to
    37852f7      
    Compare
  
    There was a problem hiding this 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.
| 
           最终方案,已经没优化空间了  | 
    
There was a problem hiding this 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]>
| 
           ai误我,ai建议我选择AcquireReference竟态的版本,😅  | 
    
无锁线程安全的SyncClosers最终版本
Close方法的竟态从n次优化到最多2次