RFR: 8331553: Windows JVM leaks Event and Thread handles when multiple threads are used [v2]

Viktor Klang vklang at openjdk.org
Thu Aug 1 09:14:43 UTC 2024


On Thu, 1 Aug 2024 04:38:11 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> @djelinski @dholmes-ora Couldn't it be that the producer thread is already scheduled, so it can reacquire the monitor whereas if the consumer was parked then the wake-up "lag" means that statistically it will lose?
>
> @viktorklang-ora the question is why the two APIs seems to be behaving so differently. I would expect `WaitForSingleObject` and `WaitOnAddress` to be very similar internally - though speculation on my part.

@dholmes-ora From the [documentation](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitonaddress) it would seem like WaitOnAddress behaves differently from WaitForSingleObject.

For instance, the following passage: "WaitOnAddress is more efficient [...] because WaitOnAddress does not interfere with the thread scheduler." <-- this suggests (to me) that it is some form of spin-wait.

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

PR Comment: https://git.openjdk.org/jdk/pull/19778#issuecomment-2262522827


More information about the build-dev mailing list