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

Signals have some wierd properties; a process-directed signal (i.e. the usual one you’d send with kill) chooses an arbitrary thread and invokes the signal handler. You can get in to some weird situations with signals and threads. If you’re using signals as an ipc mechanism, a useful tip is to just block the signal and register a signalfd on poll/epoll to regain control flow control.


The classic solution would be to fork a special signal catching thread and play with the signal masks to ensure the signal goes there. This is what glib does if I recall correctly.

... Which of course seems very silly today. Signalfd is a much nicer API to use for new programs!




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

Search: