4 ms·
FWIW Plan 9 uses what it calls a "notification" mechanism: http://plan9.bell-labs.com/magic/man2html/2/notify http://plan9.bell-labs.com/magic/man2html/2/notify
by jbarham 10y ago
FWIW Plan 9 uses what it calls a "notification" mechanism: http://plan9.bell-labs.com/magic/man2html/2/notify http://plan9.bell-labs.com/magic/man2html/2/notify
- adrianratnapala 10y agoWhile the "notification" system seems is cleaner than the signals system (and presumably avoids those races fixed by BSD) -- it does not seem fundamentally different. If I am understanding that man page correctly, it does nothing at all to fix EINTR: "If the note interrupted an incomplete system call, that call returns an error (with error string interrupted) after the process resumes."
- nitwit005 10y agoEINTR is only "needed" because of the situation where a call is made to a blocking system call like read, and a signal is received before it completes. It needs to cancel the blocking call so that it can run the signal handler. If you get rid of signals, you wouldn't need EINTR. Even with signals, what people do 99% of the time is just retry the system call immediately. It would probably have been much better to have it do so automatically by default, avoiding exposing EINTR to most users.
- JdeBP 10y ago... and, thence, SA_RESTART.
- to3m 10y agoMore on what EINTR is for: http://250bpm.com/blog:12 http://250bpm.com/blog:12
- noselasd 10y agoEINTR is retried automatically if you use sigaction() and set the SA_RESTART flag. If you use signal() instead of sigaction() it depends on your OS whether EINTR is automatically retried - never use signal(). (There's a few exceptions still - partial completed syscalls, e.g. a signal can cause read() to return partial data or sleep() to return before it should - neither case gives you EINTR though)
- adrianratnapala 10y agoYes, but how does the Plan9 "notify" mechanism help with any of that? It seems to just be a tidied up version of signals, and therefore "needs" to do EINTR in much the same way as Unix.