use select to reduce the CPU impact of this polling loop