Re: [racket-users] Why would writing to a pipe fail?

2021-06-22 Thread Matthew Flatt
At Fri, 18 Jun 2021 05:29:14 -0400, George Neuner wrote: > My point was that the docs for write-bytes-avail et al specifically > mention "flush" of data, and in a way that implies (to me) that there is > expected to be something else underlying the buffer to "flush" to, e.g., > storage media,

Re: [racket-users] Why would writing to a pipe fail?

2021-06-18 Thread George Neuner
Hi Matthew, Sorry for the delay in replying. On 6/17/2021 7:08 PM, Matthew Flatt wrote: At Wed, 16 Jun 2021 17:33:56 -0400, George Neuner wrote: > > Dumb question ... why should non-blocking I/O worry about "flush" at > all.  Why not behave like native I/O where writes are guaranteed only

Re: [racket-users] Why would writing to a pipe fail?

2021-06-17 Thread Matthew Flatt
At Wed, 16 Jun 2021 17:33:56 -0400, George Neuner wrote: > On 6/16/2021 3:45 PM, Matthew Flatt wrote: > > At Wed, 16 Jun 2021 14:25:40 -0400, George Neuner wrote: > > > It looks like the problem > > > is that "flush" is not defined ... > > > > Yes, "returns without blocking after writing as many

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread George Neuner
Forgot to mention this is using  CS 8.1 -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread George Neuner
On 6/16/2021 7:01 PM, Shu-Hung You wrote: Out of curiosity, I wrapped David's code in a loop and tried to write 509 bytes in each iteration. From the output, it looks like CS doesn't implement pipes using a fixed-size buffer. I'm also not sure how many different buffers there are. I think this

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread Shu-Hung You
Out of curiosity, I wrapped David's code in a loop and tried to write 509 bytes in each iteration. From the output, it looks like CS doesn't implement pipes using a fixed-size buffer. I'm also not sure how many different buffers there are. I think this has something to do with George's question.

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread George Neuner
On 6/16/2021 3:45 PM, Matthew Flatt wrote: At Wed, 16 Jun 2021 14:25:40 -0400, George Neuner wrote: > It looks like the problem > is that "flush" is not defined ... Yes, "returns without blocking after writing as many bytes as it can immediately flush" is vague, and more or less

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread David Storrs
In case anyone else runs into this issue and is worried about their code blocking forever, here's a version that will time out. The only change is the use of sync/timeout and value-evt. https://docs.racket-lang.org/value-evt/index.html (require value-evt) (define bstr (make-shared-bytes 509 5))

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread David Storrs
Got it. Thanks. On Wed, Jun 16, 2021 at 3:45 PM Matthew Flatt wrote: > At Wed, 16 Jun 2021 14:25:40 -0400, George Neuner wrote: > > It looks like the problem > > is that "flush" is not defined ... > > Yes, "returns without blocking after writing as many bytes as it can > immediately flush" is

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread Matthew Flatt
At Wed, 16 Jun 2021 14:25:40 -0400, George Neuner wrote: > It looks like the problem > is that "flush" is not defined ... Yes, "returns without blocking after writing as many bytes as it can immediately flush" is vague, and more or less intentionally so. The intent it really "writes as much as

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread David Storrs
For the record, it doesn't work in 8.1 either. On Wed, Jun 16, 2021 at 2:44 PM David Storrs wrote: > > > On Wed, Jun 16, 2021 at 2:25 PM George Neuner > wrote: > >> >> On 6/16/2021 2:16 PM, David Storrs wrote: >> >> Damn. Sorry, I posted out of sync versions of code and output. This is >>

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread David Storrs
On Wed, Jun 16, 2021 at 2:25 PM George Neuner wrote: > > On 6/16/2021 2:16 PM, David Storrs wrote: > > Damn. Sorry, I posted out of sync versions of code and output. This is > correct: > > (define bstr (make-shared-bytes 509 5)) > (define rx-pipe-size 16777216) > (define-values (rx-in rx-out)

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread George Neuner
On 6/16/2021 2:16 PM, David Storrs wrote: Damn.  Sorry, I posted out of sync versions of code and output.  This is correct: (define bstr (make-shared-bytes 509 5)) (define rx-pipe-size 16777216) (define-values (rx-in rx-out) (make-pipe rx-pipe-size)) (define (room-in-rx-pipe? bstr)   (define

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread David Storrs
Damn. Sorry, I posted out of sync versions of code and output. This is correct: (define bstr (make-shared-bytes 509 5)) (define rx-pipe-size 16777216) (define-values (rx-in rx-out) (make-pipe rx-pipe-size)) (define (room-in-rx-pipe? bstr) (define avail (- rx-pipe-size (pipe-content-length

Re: [racket-users] Why would writing to a pipe fail?

2021-06-16 Thread George Neuner
On 6/16/2021 1:19 PM, David Storrs wrote: I'm getting bytes off the wire and attempting to write them to a port.  I have a check in place to verify that the pipe has free space but when I attempt to reports that yes, there is space, and then it writes and fails regardless and I'm not sure

[racket-users] Why would writing to a pipe fail?

2021-06-16 Thread David Storrs
I'm getting bytes off the wire and attempting to write them to a port. I have a check in place to verify that the pipe has free space but when I attempt to reports that yes, there is space, and then it writes and fails regardless and I'm not sure why. The following is a simplified version of the