gnodet commented on PR #3448:
URL: https://github.com/apache/maven-surefire/pull/3448#issuecomment-7394172289

   ### CountdownCloseable.java line 56
   
   ✅ **Correct fix for spurious wakeup bug**
   
   The change from `if (countdown > 0)` to `while (countdown > 0)` is the 
correct and standard pattern for using `Object.wait()`. This fixes a potential 
race condition where:
   
   1. A spurious wakeup could occur (allowed by JLS)
   2. With `if`, the method would return even though `countdown > 0`
   3. With `while`, the thread correctly re-checks the condition and waits 
again if needed
   
   This follows the pattern documented in the Java Language Specification and 
is a necessary fix.
   
   _Claude Code on behalf of Guillaume Nodet_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to