summaryrefslogtreecommitdiffstats
path: root/struct.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-03-23 06:31:10 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-03-23 06:31:10 -0700
commit37e5a84d7483a6f323d7f069ac3b33ecd0c9d8e7 (patch)
tree999c63b21968ea22b68d69df43b9405c810fae99 /struct.h
parentb629707890bf3f527f1d33a17815ef214ee6dc39 (diff)
downloadtxr-37e5a84d7483a6f323d7f069ac3b33ecd0c9d8e7.tar.gz
txr-37e5a84d7483a6f323d7f069ac3b33ecd0c9d8e7.tar.bz2
txr-37e5a84d7483a6f323d7f069ac3b33ecd0c9d8e7.zip
call-finalizers: allow recursion.
Code to invoke finalizers and remove them from the list is consolidated: both the gc and call-finalizers now use the same lower-level function. Finalizers may now themselves call-finalizers; it is no longer "unspecified behavior". This greatly improves the the TXR Lisp support for RAII, since :fini handlers of objects can call finalization on related objects. For instance a container being finalized can call the finalizers of contained objects. * gc.c (call_finalizers_impl): New function. Gathers all eligible finalizer registrations into a local list, first, removing them from the global list. Then does the calls in a second pass. Also, relative to the original functions which it replaces, this fixes an incorrect case: when the list is of length 1 and contains an eligible entry, in which case the global final_tail pointer is left aiming at a local variable! (is_reachable_final): New static function. (call_finalizers): Use call_finalizers_impl, specifying is_reachable_final as the predicate. (is_matching_final): New static function. (gc_call_finalizers): Use call_finalizers_impl, specifying is_matching_final as the predicate. * txr.1: Update documentation about call-finalizers.
Diffstat (limited to 'struct.h')
0 files changed, 0 insertions, 0 deletions