-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
std::io: retry write operation on ErrorKind::WouldBlock
If writing to tty when O_NONBLOCK bit is set and the lock to tty is held (e.g. multiple threads writing to console), the Linux kernel returns -EAGAIN. (https://elixir.bootlin.com/linux/v5.19/source/drivers/tty/tty_io.c#L952) Not accounting for -EAGAIN (i.e. ErrorKind::WouldBlock), results in a panic. Its better to retry the write as the other thread could have release the lock by then. Signed-off-by: Usama Arif <[email protected]> Reviewed-by: Fam Zheng <[email protected]>
- Loading branch information
Showing
2 changed files
with
23 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters