c - read from disk and EINTR -


is necessary check errno == eintr if read massive amounts of data? use pread() function read. in time have never seen eintr returned, have seen code online explicitely checks it.

so necessary check eintr , maybe repeat call?

eintr returned when system call interrupted result of process receiving signal. if process blocked in kernel, waiting read complete, , signal caught, may wake kernel; depends on if operation interruptable. sleeping i/o routine woken , expected return eintr user-space.

just before kernel returns user space, checks pending signals. if signal pending, take action associated signal. possible actions include: dispatching signal signal handler, killing process, or ignoring signal. assuming not kill process and/or signal handler returns normally, system call return eintr.

if not expecting this, typically want try action again, can used way gracefully abort i/o operation. example, alarm(2) can used implement timeout, sigalrm delivered if i/o not complete in timely manner. in signal handler, set flag indicating timeout , when read operation returns eintr, can check timeout flag.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -