Skip to content
This repository has been archived by the owner on May 6, 2018. It is now read-only.

Clarify behaviour of flush on WouldBlock error #88

Closed
AljoschaMeyer opened this issue Nov 16, 2017 · 2 comments
Closed

Clarify behaviour of flush on WouldBlock error #88

AljoschaMeyer opened this issue Nov 16, 2017 · 2 comments

Comments

@AljoschaMeyer
Copy link

Is an implementation of the AsyncWrite trait allowed to block on flushing?

The first sentence of the trait doc comment indicates that this should not be the case:

This trait inherits from io::Write and indicates that an I/O object is nonblocking, meaning that it will return an error instead of blocking when bytes cannot currently be written, but hasn't closed.

But the remainder of the documentation only explicitely talks about how write should handle WouldBlock errors, not about flush.

cc facebookarchive/rust-partial-io#17

@sunshowers
Copy link

As of the latest version of partial-io, we're now treating WouldBlock during flush the same as WouldBlock during write as far as notifying the current task goes.

@carllerche
Copy link
Member

@Sid0 This is correct (and should be documented). It is expected that both write and flush will used from the same task.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants