RFR: 8332084: Ensure JdkConsoleImpl.restoreEcho visibility in a shutdown hook [v8]
Naoto Sato
naoto at openjdk.org
Tue May 21 22:58:02 UTC 2024
On Tue, 21 May 2024 22:51:14 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> Making sure `restoreEcho` correctly reflects the state in the shutdown thread, which differs from the application's thread that issues the `readPassword()` method.
>
> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>
> Used a dedicate lock for restoreEcho
Based on an internal discussion regarding Stuart's above comment, I changed the `restoreEcho` field back to the original. Instead of making it volatile, synchronizing it with a dedicated lock would ensure visibility and atomic status updates (no races).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19184#issuecomment-2123561717
More information about the core-libs-dev
mailing list