Penguin

Differences between version 2 and predecessor to the previous major change of EINTR.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 2 Last edited on Monday, May 17, 2004 9:38:39 pm by HannesWyss Revert
Older page: version 1 Last edited on Wednesday, February 12, 2003 12:18:50 am by PerryLorier Revert
@@ -1,3 +1,31 @@
 !!!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>