;;; Copyright (C) 2025 Free Software Foundation, Inc. ;;; ;;; This library is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU Lesser General Public License as ;;; published by the Free Software Foundation, either version 3 of the ;;; License, or (at your option) any later version. ;;; ;;; This library is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; Lesser General Public License for more details. ;;; ;;; You should have received a copy of the GNU Lesser General Public ;;; License along with this program. If not, see ;;; . (define-module (system finalizers) #:export (add-finalizer! %guardian-finalizer-priority %default-finalizer-priority)) (eval-when (expand load eval) (load-extension (string-append "libguile-" (effective-version)) "scm_init_finalizers_module")) (define %guardian-finalizer-priority 1) (define %default-finalizer-priority 0) (define* (add-finalizer! obj proc #:optional (priority %default-finalizer-priority)) "Add a finalizer @var{proc} to object @var{obj}, with priority @var{priority}. Return the finalizer object." (%add-finalizer! obj proc priority))