select() is a great system call. You can pack any number of file descriptors, socket descriptors, pipes, etc. and get notified in a synchronous fashion when input becomes availa
timerfd_create does exactly this. It's a fairly recent addition to the linux kernel and might not be available on all distros yet though.