previous: >>108479107
#define __NR_rt_sigtimedwait 128
https://man7.org/linux/man-pages/man2/sigtimedwait.2.html
tl;dr:
wait for a signal
it's pretty nice that this gives the option to provide a timeout. i am always a little wary about calling functions that perform a blocking wait without the ability to provide a timeout. if even one tiny little thing goes wrong, boom deadlock.
so for that reason, this syscall is decently nice.
it's a bit unfortunate that it can't wait for synchronous signals, but then again, you wouldn't really be waiting for those, anyway. in most cases, i think you're probably better off with signal handlers, but i guess i could see some use cases for this guy. it's just a bit annoying that you have to block the signals in all other threads first. god, that's actually one thing about signals that's always really, really grossed me out: it's totally arbitrary which thread handles a signal. uhh, excuse me? fucking why? well, i know why. it would be marginally less performant to have any sort of sane logic apply, and well we wouldn't want that, now would we, silly? so we as developers are left to work around this, gross hacks be damned
relevant resources:
man man
man syscalls
https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/