checking for EINTR and using blocking mode seems to be most efficient for my use case