Hacker News new | ask | show | jobs
by gpderetta 91 days ago
Of course you don't spawn a thread from the signal handler. You start it first thing in main and park it waiting for a wakeup.
1 comments

Ah duh, hadn't thought of that. Same pipe trick, but with another thread blocking on the read end.

That is a much simpler change than refactoring the main thread to poll on several FDs instead of just blocking in recv().