Skip to content

Commit 9567146

Browse files
aykevldeadprogram
authored andcommitted
runtime: use SA_RESTART when registering a signal
This really is the only sane way to register a signal. If this flag is not set, many syscalls will return EINTR (and not complete their operation) which will be a massive source of hard-to-debug bugs.
1 parent 6601c1b commit 9567146

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/runtime/signal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ void tinygo_signal_handler(int sig);
1515
void tinygo_signal_enable(uint32_t sig) {
1616
struct sigaction act = { 0 };
1717
act.sa_handler = &tinygo_signal_handler;
18+
act.sa_flags = SA_RESTART;
1819
sigaction(sig, &act, NULL);
1920
}
2021

0 commit comments

Comments
 (0)