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

Use select() or epoll() or kqueue() to see if your socket is ready for reading. That way you can monitor your global variable too. That’s the correct way to do it.

If you have multiple threads, you start one just to mind signals.

Signal handlers are extremely limited in what they can do, that’s the point. They are analogous to hardware interrupt handlers.



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

Search: