[Ur] howto register cleanup which is neither uw_malloc nor transactional?
Adam Chlipala
adamc at impredicative.com
Sat Dec 4 10:46:56 EST 2010
I'm a bit confused by your message. In my reply, I will assume that you
are asking only about actions to be taken upon completion of request
handling, despite the fact that you use the word "cleanup" which, in the
Ur/Web runtime system, has a meaning which involves actions being taken
before a request finishes.
Marc Weber wrote:
> This requires two callbacks:
> - one for decreasing the usage counter on Ruby objcets (similar to when
> uw_malloc storage is freed)
> (uw_register_transactional or uw_set_global could be abused ?)
> - one callback to clear the cache (eg of http requests) after a request
> stops being executed which is called in all cases:
> * retried too often, fatal, or success
>
These both seem like straightforward uses of the "free" callback passed
to uw_register_transactional().
BTW, "uw_malloc() storage" is never "freed," and there are no "counters"
involved.
> Is there a way to run code on startup ?
>
Yes. Write something like:
task initialize = (* something of type [transaction {}] *)
The timing of this might not be quite what you expect, so let me know if
you need a new task type that runs at different times.
More information about the Ur
mailing list