(declare (ignore table))
`(progn ,@body))
+(defmacro defglobal (name value &rest doc)
+ `(eval-when (:compile-toplevel :load-toplevel :execute)
+ (defparameter ,name
+ (if (boundp ',name)
+ (symbol-value ',name)
+ ,value)
+ ,@doc)))
+
;;; The GENESIS function works with fasl code which would, in the
;;; target SBCL, work on ANSI-STREAMs (streams which aren't extended
;;; Gray streams). In ANSI Common Lisp, an ANSI-STREAM is just a
(in-package "SB!IMPL")
-(defvar *finalizer-store* nil)
+(defglobal **finalizer-store** nil)
-(defvar *finalizer-store-lock*
+(defglobal **finalizer-store-lock**
(sb!thread:make-mutex :name "Finalizer store lock."))
(defmacro with-finalizer-store-lock (&body body)
- `(sb!thread::with-system-mutex (*finalizer-store-lock* :without-gcing t)
+ `(sb!thread::with-system-mutex (**finalizer-store-lock** :without-gcing t)
,@body))
(defun finalize (object function &key dont-save)
(error "Cannot finalize NIL."))
(with-finalizer-store-lock
(push (list (make-weak-pointer object) function dont-save)
- *finalizer-store*))
+ **finalizer-store**))
object)
(defun deinit-finalizers ()
;; remove :dont-save finalizers
(with-finalizer-store-lock
- (setf *finalizer-store* (delete-if #'third *finalizer-store*)))
+ (setf **finalizer-store** (delete-if #'third **finalizer-store**)))
nil)
(defun cancel-finalization (object)
;; run.
(when object
(with-finalizer-store-lock
- (setf *finalizer-store*
- (delete object *finalizer-store*
+ (setf **finalizer-store**
+ (delete object **finalizer-store**
:key (lambda (list)
(weak-pointer-value (car list))))))
object))
(defun run-pending-finalizers ()
(let (pending)
(with-finalizer-store-lock
- (setf *finalizer-store*
+ (setf **finalizer-store**
(delete-if (lambda (list)
(when (null (weak-pointer-value (car list)))
(push (second list) pending)
t))
- *finalizer-store*)))
+ **finalizer-store**)))
;; We want to run the finalizer bodies outside the lock in case
;; finalization of X causes finalization to be added for Y.
(dolist (fun pending)
;;;; here: certainly enough that I (dan, 2003.1.22) don't want to mess
;;;; around deciding how to thread-safetify it. So we use a Big Lock.
;;;; Because this code is mutually recursive with the compiler, we use
-;;;; the *world-lock*.
+;;;; the **WORLD-LOCK**.
;;;; miscellaneous load utilities
(!begin-collecting-cold-init-forms)
;;; This lock is seized in the compiler, and related areas -- like the
;;; classoid/layout/class system.
-(defvar *world-lock*)
+(defglobal **world-lock** nil)
(!cold-init-forms
- (setf *world-lock* (sb!thread:make-mutex :name "World Lock")))
+ (setf **world-lock** (sb!thread:make-mutex :name "World Lock")))
(!defun-from-collected-cold-init-forms !world-lock-cold-init)
(defmacro with-world-lock (() &body body)
- `(sb!thread:with-recursive-lock (*world-lock*)
+ `(sb!thread:with-recursive-lock (**world-lock**)
,@body))
(declaim (type fixnum *compiler-sset-counter*))