Re: [racket-users] Wills, plumbers, and checking if a port is closed

2020-07-02 Thread David Storrs
Doh, just realized I never responded to this. Thank you guys so much. As always, it's really appreciated. On Tue, Jun 30, 2020, 7:21 PM Ryan Culpepper wrote: > Here's a function that creates a thread that waits until a port is closed > and then prints a message: > > (define

Re: [racket-users] Wills, plumbers, and checking if a port is closed

2020-06-30 Thread Ryan Culpepper
Here's a function that creates a thread that waits until a port is closed and then prints a message: (define (watch-for-port-close p) (thread (lambda () (sync (port-closed-evt out)) (eprintf "port closed\n" For example: (define out (open-output-string)) (watch-for-port-close out)

Re: [racket-users] Wills, plumbers, and checking if a port is closed

2020-06-30 Thread George Neuner
On 6/30/2020 4:27 PM, David Storrs wrote: I have a port that (my current theory says) is being closed when it shouldn't, but I'm having trouble isolating exactly where and when.  I thought maybe I could do something Rackety to say "as soon as this port gets closed, run this function".  I

Re: [racket-users] Wills, plumbers, and checking if a port is closed

2020-06-30 Thread Matthew Flatt
At Tue, 30 Jun 2020 16:27:56 -0400, David Storrs wrote: > I have a port that (my current theory says) is being closed when it > shouldn't, but I'm having trouble isolating exactly where and when. I > thought maybe I could do something Rackety to say "as soon as this port > gets closed, run this

Re: [racket-users] Wills, plumbers, and checking if a port is closed

2020-06-30 Thread Sorawee Porncharoenwase
It doesn't look like will executor will do what you want, since it has to do with garbage collection rather than port closing. This could be overkill, but it's possible to construct a custom port ( https://docs.racket-lang.org/reference/customport.html). Is it possible to construct a new port