[plt-scheme] custodian + process/ports

From: Tom Schouten (tom at zwizwa.be)
Date: Tue Jul 1 18:31:35 EDT 2008

>> ... what i don't understand is why the 'close 
>> method of the port created by 'make-output-port doesn't get called by 
>> 'custodian-shutdown-all.
> I'm not sure what you are asking here.

Is there a reason why ports created with 'make-output-port do not get closed 
when 'custodian-shutdown-all is called? Why only file-stream/socket/... 
ports? (as mentioned in 1.1.16 custodians ref doc) Is there a way to add a
thunk to a custodian, or why would that be a bad idea?

(define (make-dummy-port)
   (lambda ()
     (printf "closing\n"))))

(define p #f)
(parameterize ((current-custodian c)) (set! p (make-dummy-port)))
(custodian-shutdown-all c)

-> nothing happens..

(close-output-port p)
-> prints "closing\n"

Posted on the users mailing list.