ffi/unsafe/custodian: #:atexit?' ->
#:at-exit?'
This commit is contained in:
parent
1800680c6b
commit
bb3545ddf7
|
@ -559,7 +559,7 @@
|
|||
(define impl (com-object-impl obj))
|
||||
(set-com-impl-mref!
|
||||
impl
|
||||
(register-custodian-shutdown impl impl-release #:atexit? #t))
|
||||
(register-custodian-shutdown impl impl-release #:at-exit? #t))
|
||||
;; If we don't finalize the object, then it could
|
||||
;; happen that the object becomes unreachable and
|
||||
;; pointers that the object references could be
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
(cast shutdown-callback (_fun #:atomic? #t _racket _racket -> _void) _fpointer))
|
||||
|
||||
(define (register-custodian-shutdown obj proc [custodian (current-custodian)]
|
||||
#:atexit? [atexit? #f]
|
||||
#:at-exit? [at-exit? #f]
|
||||
#:weak? [weak? #f])
|
||||
(define proc+self (cons proc
|
||||
shutdown-callback)) ; proc as data -> ffi callback retained
|
||||
(if atexit?
|
||||
(if at-exit?
|
||||
(scheme_add_managed_close_on_exit custodian
|
||||
obj shutdown_callback proc+self)
|
||||
(scheme_add_managed custodian
|
||||
|
|
|
@ -11,7 +11,7 @@ registering shutdown callbacks with custodians.}
|
|||
@defproc[(register-custodian-shutdown [v any/c]
|
||||
[callback (any/c . -> . any)]
|
||||
[custodian custodian? (current-custodian)]
|
||||
[#:atexit? atexit? any/c #f]
|
||||
[#:at-exit? at-exit? any/c #f]
|
||||
[#:weak? weak? any/c #f])
|
||||
cpointer?]{
|
||||
|
||||
|
@ -20,7 +20,7 @@ unspecified Racket thread) to @racket[v] when @racket[custodian] is
|
|||
shutdown. The result is a pointer that can be supplied to
|
||||
@racket[unregister-custodian-shutdown] to remove the registration.
|
||||
|
||||
If @racket[atexit?] is true, then @racket[callback] is applied when
|
||||
If @racket[at-exit?] is true, then @racket[callback] is applied when
|
||||
Racket exits, even if the custodian is not explicitly shut down.
|
||||
|
||||
If @racket[weak?] is true, then @racket[callback] may not be called
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
(when done? (error "duplicate!"))
|
||||
(set! done? (equal? x '(1 . 2))))
|
||||
c
|
||||
#:atexit? #t))
|
||||
#:at-exit? #t))
|
||||
|
||||
(unregister-custodian-shutdown val (reg))
|
||||
(void (reg))
|
||||
|
|
Loading…
Reference in New Issue
Block a user