Should I retry system calls that fail because of EINTR?

610 views Asked by At

I have seen code like this:

again:
    if ((n = read(fd, buf, BUFFSIZE)) < 0) {
        if (errno == EINTR)
            goto again;     /* just an interrupted system call */
        /* handle other errors */
    }

The idea is to retry a system call if it fails because it was interrupted. But is it a good idea? When is it a good idea and when should I not do this? Is this specific to certain platforms, or can Windows or Unix have system calls fail with EINTR?

0

There are 0 answers