Implement poll() on top of select()