Skip to content

Apply interruptible sleep to slow devices #580

@cahirwpz

Description

@cahirwpz

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).
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions