Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is not a good use of EINTR, you can even see it’s fundamentally flawed given this usage introduces a race condition.

pselect() isn’t the right answer given it’s not portable and it’s totally broken on various versions of macOS. signalfd() is also not the answer, it suffers from a broken design: https://ldpreload.com/blog/signalfd-is-useless

To deal with cleanup on a signal while blocking in a robust and portable way, use the self pipe trick and select() (or equivalent).



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: