| |
 | Posted by Steven Schveighoffer | Permalink Reply |
|
Steven Schveighoffer 
| https://issues.dlang.org/show_bug.cgi?id=18309
Steven Schveighoffer <schveiguy@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schveiguy@yahoo.com
--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> ---
What is the suggestion here? That tryWait should tell you the read buffer is full? Or that there be a mechanism to check for buffer being full?
I know that pipes can be unintuitive if you haven't set up your ends properly. There are all kinds of cases where you may have a race condition.
The sample above, and the solution you suggest, are both counter-intuitive to me. IMO, the solution is not to worry about the process ending until after you've exhausted the data stream.
In any case, I'm inclined to say that we aren't going to solve this problem by adding any warnings. In fact, I'd discourage having any kind of code based on the buffer being full, as your code, if written correctly, should be pretty immune to buffer sizes.
Piling on top of that -- the pipe itself is abstracted behind a File, which is *also* buffered. extracting meaningful info about the OS's pipe buffer may be a lost cause.
A solution documentation-wise would be to show that pipes are in fact subject to race conditions, and you need to be careful how you code them.
--
|