retry syscall on EINTR

select.select() may throw EINT too. I have refactored the retry logic into a decorator. I have also applied the decorator on `__init__` since it has a poll() inside.