[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: atexit in modules
From: |
Mike Gran |
Subject: |
Re: atexit in modules |
Date: |
Thu, 13 Nov 2008 18:27:43 -0800 (PST) |
> ----- Original Message ----
> > From: Ludovic Courtès address@hidden
>
> > In theory, the Right Way(tm) would be to register a finalizer for the
> > module that does `load-extension'. That can be done using a guardian,
> > but the guardian the needs to be called once in a while, e.g., in
> > `after-gc-hook' and `exit-hook'.
>
> OK. I see in the manual there is a section on guardians and a mention of
> after-gc-hook in garbage-collection section. Cool.
>
> Exit-hook is underdocumented. The one thread suggested that exit-hook is
> only
> called when using the REPL. Is that (still) true?
Continuing...
Source diving tells me that exit-hook is a REPL-only feature.
So I'm back to the idea of creating a module-level variable that exists while
the module is in memory, and then calling library_end() when that variable is
GC'd. But I can make it more schemey by using guardians and after-gc-hook as
you suggested.
Thanks,
Mike Gran