In os_bsd.cpp there are two semaphores that are posted to from signal handlers. One is a raw OS-specific semaphore (sem_t or Apple semaphore_t), while the other is a wrapper around such.
Some documentation for OSX semaphore_t indicates that it should not be used from signal handlers, e.g.
https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/synchronization/synchronization.html
Semaphores can be used any place where mutexes can occur. This
precludes their use in interrupt handlers or within the context of
the scheduler, and makes it strongly discouraged in the VM system.
If that's correct, then we should not be using OSX semaphore_t for the purpose it is being used for in os_bsd.cpp. Note that this decision to use OSX semaphore_t goes all the way back to the original BSD port integration:
http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/diff/f08d439fab8c/src/os/bsd/vm/os_bsd.cpp
Some documentation for OSX semaphore_t indicates that it should not be used from signal handlers, e.g.
https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/synchronization/synchronization.html
Semaphores can be used any place where mutexes can occur. This
precludes their use in interrupt handlers or within the context of
the scheduler, and makes it strongly discouraged in the VM system.
If that's correct, then we should not be using OSX semaphore_t for the purpose it is being used for in os_bsd.cpp. Note that this decision to use OSX semaphore_t goes all the way back to the original BSD port integration:
http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/diff/f08d439fab8c/src/os/bsd/vm/os_bsd.cpp
- relates to
-
JDK-8194763 os::signal_lookup is unused
- Resolved
-
JDK-8193308 Disallow installing user signal handlers for SIGBUS on OSX
- Resolved
-
JDK-8130038 Unify the semaphore usage in os_xxx.cpp
- Resolved