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

os: add a convenient way to ignore certain system signals #19632

Merged
merged 1 commit into from Oct 23, 2023

Conversation

shove70
Copy link
Contributor

@shove70 shove70 commented Oct 23, 2023

This PR:

  1. Added a convenient way to ignore certain system signals. It handles things differently depending on whether the current thread is the main thread or the background thread.
  2. It's also part of improving the robustness of http.get() and can be useful in net applications.
  3. Calling it is as simple as in go, in go: signal.Ignore(syscall.SIGPIPE, syscall.SIGILL, syscall.SIGURG)
import os
os.signal_ignore(.pipe, .urg)

@shove70 shove70 marked this pull request as draft October 23, 2023 09:24
@shove70 shove70 force-pushed the signal branch 5 times, most recently from b25fc65 to 24d6b34 Compare October 23, 2023 10:51
@shove70 shove70 marked this pull request as ready for review October 23, 2023 13:31
@medvednikov medvednikov merged commit 0c92c31 into vlang:master Oct 23, 2023
45 checks passed
@shove70 shove70 deleted the signal branch October 23, 2023 22:05
medvednikov added a commit that referenced this pull request Oct 23, 2023
@medvednikov
Copy link
Member

@shove70 somehow it broke v self on macos:

$ cc  -std=gnu99 -w -o v1.exe ./vc/v.c -lm -lpthread
./vc/v.c:37939:31: error: scalar initializer cannot be empty
                sigset_t mask1 = ((sigset_t){EMPTY_STRUCT_INITIALIZATION});
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

had to revert here and in vc.git

@shove70
Copy link
Contributor Author

shove70 commented Oct 24, 2023

@shove70 somehow it broke v self on macos:

$ cc  -std=gnu99 -w -o v1.exe ./vc/v.c -lm -lpthread
./vc/v.c:37939:31: error: scalar initializer cannot be empty
                sigset_t mask1 = ((sigset_t){EMPTY_STRUCT_INITIALIZATION});
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

had to revert here and in vc.git

Oh, I'm so sorry!

@medvednikov
Copy link
Member

No worries, just github actions acting weird. It should've caught it.

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.

None yet

3 participants