At Sun, 5 Aug 2012 15:02:10 -0600, Matthew Flatt wrote:
> Beware that FFI callback memory management is slightly tricky with
> scheme_add_managed():

I've added an `ffi/unsafe/custodian' library with a
`register-custodian-shutdown' function to make this easier.

The `register-custodian-shutdown' function also helps with a related
problem: calling a shutdown callback when Racket exits. Most resources
are released when the Racket process exits, but if an explicit release
is needed, supply `#:at-exit? #t'.

Of course, while `register-custodian-shutdown' makes custodian
registration easier, there are still many low-level issues to consider
--- such as the fact that the callback is invoked atomically in an
unspecified Racket thread --- which is why it's under `ffi/unsafe'.

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to