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 avail (- rx-pipe-size (pipe-content-length rx-out)))
  (displayln (format "avail: ~a" avail))
  (<= (bytes-length bstr) avail))

(displayln (format "space available? ~a " (room-in-rx-pipe? bstr)))
(displayln (format "pipe content length: ~a" (pipe-content-length rx-out)))
(define num-bytes-written (write-bytes-avail* bstr rx-out))
(unless (eq? num-bytes-written (bytes-length bstr))
  (displayln (format "rx buffer overflow. pipe content length: ~a, written ~a, expected ~a"                      (pipe-content-length rx-out) num-bytes-written (bytes-length bstr))))

(displayln "done")

-------- output:

avail: 16777216
space available? #t
pipe content length: 0
rx buffer overflow. pipe content length: 15, written 15, expected 509
done


That's ok ... my analysis was wrong anyhow.   It looks like the problem is that "flush" is not defined ... or simply doesn't work ... on Racket's pipes. *write-bytes-avail*  et al  depend on flush and so they won't work. *write-bytes*  works fine, but will block if you fill the pipe.

This looks like something for the development team.

George

--
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 the web visit 
https://groups.google.com/d/msgid/racket-users/4836be0b-f785-9394-b18f-f5228970ba44%40comcast.net.

Reply via email to