improve select and poll implementation