Penguin
Note: You are viewing an old revision of this page. View the current version.

Interrupted System Call

This is returned by the kernel if a system call was interrupted permaturely with a signal before it was able to complete. You should probably retry the syscall again. This behavour can be changed on a signal by signal basis with sigaction(2).

<blatant-plagiarism copied-from="http://www.developerweb.net/sock-faq/detail.php?id=1389">

The areas you should check for this are any socket io calls (read(s), recv(s), write(s), send(s)) and any of the "status" calls such as select and poll...

You can call the function that was interrupted again immediately... Just wrap it in a loop... e.g.

while (...someConditional...) {

retVal = select(...);

if (retVal == -1) {

if (errno == EINTR) {

continue;

}

/* Check for other errnos & handle here */

}

}

Btw, the someConditional part in the loop is so you can set a flag to cause the thing to fall through... nothing more...

Technically, if you are setting all your threads doing socket io to ignore ALL (well, all allowed) signals then you should never see an EINTR but... it does not hurt to check for it ...

</blatant-plagiarism>