[plt-scheme] custodian + process/ports
>> ... 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)
(make-output-port
#f
(current-output-port)
void
(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"