RFR: 8356173: Remove ThreadCritical [v2]

Coleen Phillimore coleenp at openjdk.org
Mon May 12 12:15:09 UTC 2025


On Sun, 11 May 2025 12:37:57 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> But the recursion checking isn't platform independent.  For POSIX it does nothing useful and is just useless
>> clutter providing a false sense of security.  I think it should be removed, and consider (as a separate thing)
>> adding a recursion assert to the Windows implementation.
>> 
>> And it should be debug-only there; there's no need to change the counter in a release build, since the
>> check is an assert.  It also doesn't need to be a counter; it could be a bool flag.  But that's really about a
>> future Windows-check.  It just shouldn't be here.
>
> I have to agree with Kim here, you can't implement a recursion check this way using a count, which has to be protected by the mutex itself. You would need to maintain an owner field, using the platform specific thread id type, which is checked before trying to acquire the mutex.

oh yeah now I see it. That's not going to work unless PlatformMutex is already recursive.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25072#discussion_r2084537711


More information about the hotspot-dev mailing list