Skip to content

add: OsSignal for scala-native#1408

Merged
fwbrasil merged 9 commits into
mainfrom
os-signal-native
Apr 20, 2026
Merged

add: OsSignal for scala-native#1408
fwbrasil merged 9 commits into
mainfrom
os-signal-native

Conversation

@hearnadam
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@fwbrasil fwbrasil merged commit d3f6538 into main Apr 20, 2026
8 checks passed
@fwbrasil fwbrasil deleted the os-signal-native branch April 20, 2026 01:30
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