use select to reduce CPU impact of the polling loop