switch to using generalized poll module instead of select.select()