Skip to content

GNU Classpath: Use pthread_sigmask() to set the signal mask - #22

Merged
guillerodriguez merged 1 commit into
masterfrom
fix/classpath-use-pthread-sigmask
Aug 21, 2026
Merged

GNU Classpath: Use pthread_sigmask() to set the signal mask#22
guillerodriguez merged 1 commit into
masterfrom
fix/classpath-use-pthread-sigmask

Conversation

@guillerodriguez

Copy link
Copy Markdown
Contributor

classlibInitialiseSignalMask() uses sigprocmask(), whose effect in multithreaded processes is unspecified by POSIX. This is OK when the function is called by the initial thread, as at that point the VM is effectively still single-threaded, but not when it is called for externally created threads that attach through JNI.

Fix this by using pthread_sigmask() instead.

This was originally generic code: commit 089a6a0 ("OpenJDK: Do not block signals") made signal mask initialisation classlib-specific, retaining the previously shared code for GNU Classpath, while the new OpenJDK implementation already used pthread_sigmask() correctly.

classlibInitialiseSignalMask() uses sigprocmask(), whose effect in
multithreaded processes is unspecified by POSIX. This is OK when the
function is called by the initial thread, as at that point the VM
is effectively still single-threaded, but not when it is called for
externally created threads that attach through JNI.

Fix this by using pthread_sigmask() instead.

This was originally generic code: commit 089a6a0 ("OpenJDK: Do not
block signals") made signal mask initialisation classlib-specific,
retaining the previously shared code for GNU Classpath, while the
new OpenJDK implementation already used pthread_sigmask() correctly.

Signed-off-by: Guillermo Rodríguez <grodriguez@ingelabs.com>
@guillerodriguez
guillerodriguez requested a review from phvega August 17, 2026 13:27
@guillerodriguez
guillerodriguez merged commit 3a41641 into master Aug 21, 2026
5 checks passed
@guillerodriguez
guillerodriguez deleted the fix/classpath-use-pthread-sigmask branch August 21, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants