Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply interruptible sleep to slow devices #580

Open
cahirwpz opened this issue Nov 5, 2019 · 1 comment
Open

Apply interruptible sleep to slow devices #580

cahirwpz opened this issue Nov 5, 2019 · 1 comment

Comments

@cahirwpz
Copy link
Owner

cahirwpz commented Nov 5, 2019

Part of pipe and tty read / write semantics is that they can be interrupted. An excerpt from Linux's signal(7) follows:

If a blocked call to one of the following interfaces is interrupted by a signal handler, then the call is automatically restarted after the signal handler returns if the SA_RESTART flag was used; otherwise the call fails with the error EINTR:

  • read(2), readv(2), write(2), writev(2), and ioctl(2) calls on "slow" devices. A "slow" device is one where the I/O call may block for an indefinite time, for example, a terminal, pipe, or socket. If an I/O call on a slow device has already transferred some data by the time it is interrupted by a signal handler, then the call will return a success status (normally, the number of bytes transferred). Note that a (local) disk is not a slow device according to this definition; I/O operations on disk devices are not interrupted by signals.
  • open(2), if it can block (e.g., when opening a FIFO; see fifo(7)).
  • wait(2), wait3(2), wait4(2), waitid(2), and waitpid(2).
    ...
@jpszczolowski
Copy link
Collaborator

I see that interruptible sleep has been implemented by @ilikeheaps in #450 #460 #462
AFAIU currently we have 3 methods:

  • cv_wait (uninterruptible),
  • cv_wait_intr (interruptible, no timeout),
  • cv_wait_timed (interruptible, timeout).

@cahirwpz cahirwpz changed the title Interruptible sleep Apply interruptible sleep to slow devices Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants