Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full stub for Windows signals #13131

Merged

Conversation

HertzDevil
Copy link
Contributor

Resolves #7339.

This defines the 6 signals required by the C standard, using their values in MSVC's headers, plus one Windows-exclusive signal, Signal::BREAK. The old Signal::KILL no longer exists, as it was only a placeholder value needed by the standard library specs to compile, and this PR removes that need. (Most POSIX signals do not exist on Windows, but technically this was already a problem for PWR, STKFLT, and UNUSED on non-Linux systems.)

All of Signal's methods (#trap, #ignore, #reset) simply raise NotImplementedError. This is intentional, as the other platform-independent replacement APIs shall suffice for the moment.

@HertzDevil HertzDevil marked this pull request as ready for review March 2, 2023 14:05
Copy link
Member

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

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

Looks good. Especially moving everything into Crystal::System. 👍
I only have a couple of comments on improving the wording in docs.

src/process.cr Outdated Show resolved Hide resolved
src/signal.cr Outdated Show resolved Hide resolved
src/signal.cr Outdated Show resolved Hide resolved
@HertzDevil
Copy link
Contributor Author

HertzDevil commented Mar 2, 2023

Pinging @lbguilherme to see if this move into Crystal::System would affect WebAssembly in any way (probably not, as the things in src/kernel.cr are still guarded and the default prelude still doesn't require "signal")

@lbguilherme
Copy link
Contributor

Pinging @lbguilherme to see if this move into Crystal::System would affect WebAssembly in any way (probably not, as the things in src/kernel.cr are still guarded and the default prelude still doesn't require "signal")

It seems fine as is, shouldn't affect anything. Actually, with your changes it could be possible to require signal on the prelude for wasm... I can test that later.

@straight-shoota straight-shoota added this to the 1.8.0 milestone Mar 6, 2023
@straight-shoota straight-shoota merged commit bbe28a0 into crystal-lang:master Mar 8, 2023
@HertzDevil HertzDevil deleted the feature/windows-signals branch March 12, 2023 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port signals to Windows
3 participants