FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version

call-finalizer

Arguments: finalizer

If a finalization is scheduled with schedule-finalization with the queue argument non-nil (which must be a queue), then when the object associated with the finalization is marked as garbage, the system puts a finalization object on the queue specified by the queue argument (and takes no further action).

The program must then deal with the finalization object by applying this function to it. The finalization object is a list of the finalization function and the object. call-finalizer calls the finalization function and ensures that the object is marked as garbage (unless the finalization function did something to make the object not garbage), just as the system would do if the finalization was scheduled with queue nil.

Example:

;; We create a queue object:

cl-user(2): (setq queue (make-instance 'mp:queue))
#<multiprocessing:queue @ #x20c4641a>

;; We will add a non-queued finalization to this object:
cl-user(3): (setq aa (make-array 4))
#(nil nil nil nil)
cl-user(4): (defun foo (x) (format t "I, ~s, am garbage!!!" x))
foo

;; Here we create the non-queued finalization:
cl-user(5): (schedule-finalization aa 'foo)
#(#(nil nil nil nil) foo nil)

;; We dereference it:
cl-user(6): (setq aa nil)
nil

;; And it is run when the object is marked as garbage:
cl-user(7): (gc)
I, #(nil nil nil nil), am garbage!!!
cl-user(8): (gc)

;; A new object, which we will schedule a queued finalization:
cl-user(9): (setq bb (make-array 5))
#(nil nil nil nil nil)

;; We schedule the finalization:
cl-user(10): (schedule-finalization bb 'foo :queue queue)
#(#(nil nil nil nil nil) (#<multiprocessing:queue @ #x2097b332> . foo) nil)

;; We dereference the object:
cl-user(11): (setq bb nil)
nil
cl-user(12): (gc)
cl-user(13): (gc)
cl-user(14): (gc)

;; Finalization is not run even after three gc's.

;; We run the finalization ourselves:
cl-user(15): (call-finalizer (mp:dequeue queue))
I, #(nil nil nil nil nil), am garbage!!!
nil
cl-user(16): 

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version