[jdk17] RFR: 8269865: Async UL needs to handle ERANGE on exceeding SEM_VALUE_MAX [v3]

Xin Liu xliu at openjdk.java.net
Wed Jul 7 05:26:51 UTC 2021


On Wed, 7 Jul 2021 00:40:10 GMT, David Holmes <dholmes at openjdk.org> wrote:

> I'm surprised macOS has no overflow checks, it looks like its counter will just wrap when it overflows - which would break things, but of course is very unlikely in real use.

Unlike Posix and Win32, it's not easy for me to find any document about Darwin semaphore API. 

I guess this is the equivalence of glibc on MacOS.  check out `semaphore_signal_internal`.
https://opensource.apple.com/source/xnu/xnu-344.21.74/osfmk/kern/sync_sema.c.auto.html

if count has overflown, it should return kr from `wait_queue_wakeup64_thread_locked`.

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

PR: https://git.openjdk.java.net/jdk17/pull/216


More information about the hotspot-runtime-dev mailing list