sync I/O with select