On Thu, 7 Mar 2024 01:31:09 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:
>> Semaphore seems simpler/cleaner and ready to use. > > It's such a rare race and unusual condition that we could execute more Java > code, that I started out with just a shared bit. Then David suggested a > semaphore that obeys the safepoint protocol, which seems a lot better. I've > literally skimmed over OSThreadWaitState. It looks like > Semaphore::wait_with_a_safepoint_check() uses it. I still don't know why it > exists: > > > // Note: the ThreadState is legacy code and is not correctly implemented. > // Uses of ThreadState need to be replaced by the state in the JavaThread. > > enum ThreadState { > > > Does a PlatformMutex handle priority-inheritance? It still feels like it > would be overkill for this usage. I hope this RecursiveLocker does not > become more widely used, where we would have to replace the simple > implementation with something more difficult. We should discourage further > use when possible. Thanks for your last comment because I was worried there's a lot of other code I should know about. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17739#discussion_r1516129405