On Thu, 1 Aug 2024 04:38:11 GMT, David Holmes <dhol...@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

Reply via email to