Use poll() instead of select()