Skip to content

add: OsSignal for scala-native#1408

Open
hearnadam wants to merge 6 commits intomainfrom
os-signal-native
Open

add: OsSignal for scala-native#1408
hearnadam wants to merge 6 commits intomainfrom
os-signal-native

Conversation

@hearnadam
Copy link
Collaborator

@hearnadam hearnadam commented Aug 17, 2025

Problem

Native binaries currently don't respect signal interrupts.
/fixes #1240

Solution

Register native signal handlers.

Notes

I didn't find a good way to test this. Assuming it gets merged, we can use the snapshots to build a test app.

import scala.scalanative.unsafe.*

/** Internal global dispatcher to avoid capturing local state in C callbacks. */
private object NativeSignalDispatch:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to get around CFuncPtr.fromScalaFunction introducing undefined behavior when capturing lambdas. Not sure about the correctness.

@hearnadam hearnadam marked this pull request as ready for review August 25, 2025 03:20
Copy link
Collaborator

@ahoy-jon ahoy-jon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just be tested with a snapshot build

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.

[feature]: add OsSignal for Scala Native

3 participants