Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
fanf2
1y ago
0 comments
Save
Share
Exactly, yes :-) Signal handlers have so many hazards it's vital to keep them as simple as possible.
0 comments
5 comments · 3 top-level
top
newest
oldest
rwmj
1y ago
· 1 in thread
A rule I try to follow: either set a global variable or write to a self pipe (using the write syscall), and handle the signal in the main loop.
cesarb
1y ago
> either set a global variable
IIRC, the rule is also that said global variable must have the type "volatile sig_atomic_t".
growse
1y ago
· 1 in thread
I'm not overly familiar with the language and tooling ecosystem, but how trivial is this to detect on a static analysis?
kccqzy
1y ago
Quite easy.
lokar
1y ago
You should read the sigsev handler at google, it’s great, doing all kinds of things. Of course it’s going to crash at some point anyway….
j
/
k
navigate · click thread line to collapse