Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-04-22 16:55:08


From: "Boris" <boris_at_[hidden]>
> Caleb Epstein wrote:
> > [...]
> >> Also, how should the stream object behave in case of EWOULDBLOCK? Set
> >> failbit? Even if we use a wouldblockbit, we still need to set
> >> failbit,
> >> as the only thing clear is that the operation was *not* successful.
> >
> > I would not recommend combining non-blocking I/O with streams, at
> > least not in any way that becomes visible to the user of the stream.
>
> As far as I can see EWOULDBLOCK is just another reason for a stream to fail.
> If you use << or >> with streams you must be prepared for failure any way.
> The only difference with EWOULDBLOCK is that you have to call << or >>
> again. However if I think about it I wonder how reasonable non-blocking I/O
> streams are at all as they don't support multiplexing - the application
> would need to call << or >> again and again?

How would the user level code know which insertion or extraction
to repeat in an expression like this:

   s << a << b << c << d;

It seems that there should be a setting that dictates how many
times to retry, have the library retry that number of times and,
if it still fails, throw an exception.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk