I think that's the only safe way to make a thread keep running outside
the custodian that will be killed.

If starting a program under another custodian is too much of a hassle,
you could access the root custodian via the FFI and create a thread
owned by it. See the implementation of `register-finalizer` at the end
of `ffi/unsafe`.

At Fri, 7 Aug 2015 11:32:11 -0700 (PDT), Roman Klochkov wrote:
> I need to make an action when current custiodian shutdowns.
> 
> Now I have something like
> 
> (define (with-status main-custodian)
>    (define a-box (make-custodian-box (current-custodian) #t))
>    (parameterize ([current-custodian main-custodian])
>        (thread (λ ()
>                   (sync a-box)
>                   (do-logoff))))
> 
> And in main program
> 
> (thread (lambda ()
>           (define main-custodian (current-custodian))
>           (parameterize ([current-custodian (make-custodian])
>             ....
>             (with-status main-custodian)
>             ...)))
> 
> Is it the only way or can I somehow make a thread outside of the current 
> custodian?
> 
> -- 
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to