use select to tell when there are events to read