1.0.11.24: internal hash-table usage thread-safety, part 2
authorNikodemus Siivola <nikodemus@random-state.net>
Wed, 14 Nov 2007 18:30:14 +0000 (18:30 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Wed, 14 Nov 2007 18:30:14 +0000 (18:30 +0000)
* Logical hosts.

* TRACE.

* Instrumenting profiler.

* Mapping over *PACKAGE-NAMES*.

src/code/ntrace.lisp
src/code/profile.lisp
src/code/target-package.lisp
src/code/target-pathname.lisp
version.lisp-expr

index 4404d66..c9cca4d 100644 (file)
@@ -37,7 +37,7 @@
 
 ;;; a hash table that maps each traced function to the TRACE-INFO. The
 ;;; entry for a closure is the shared function entry object.
-(defvar *traced-funs* (make-hash-table :test 'eq))
+(defvar *traced-funs* (make-hash-table :test 'eq :synchronized t))
 
 ;;; A TRACE-INFO object represents all the information we need to
 ;;; trace a given function.
index 754fcb0..15b8c74 100644 (file)
@@ -46,7 +46,8 @@
   (make-hash-table
    ;; EQL testing isn't good enough for generalized function names
    ;; like (SETF FOO).
-   :test 'equal))
+   :test 'equal
+   :synchronized t))
 (defstruct (profile-info (:copier nil))
   (name              (missing-arg) :read-only t)
   (encapsulated-fun  (missing-arg) :type function :read-only t)
index 2e5bef5..d4876ef 100644 (file)
@@ -46,7 +46,8 @@
 ;;; core image
 (defconstant +package-hashtable-image-load-factor+ 0.5)
 
-;;; All destructive package modifications are serialized on this lock.
+;;; All destructive package modifications are serialized on this lock,
+;;; plus iterations on *PACKAGE-NAMES*.
 (defvar *package-lock*)
 
 (!cold-init-forms
@@ -690,10 +691,11 @@ implementation it is ~S." *default-package-use-list*)
   #!+sb-doc
   "Return a list of all existing packages."
   (let ((res ()))
-    (maphash (lambda (k v)
-               (declare (ignore k))
-               (pushnew v res))
-             *package-names*)
+    (with-packages ()
+      (maphash (lambda (k v)
+                 (declare (ignore k))
+                 (pushnew v res))
+               *package-names*))
     res))
 \f
 (defun intern (name &optional (package (sane-package)))
@@ -1300,11 +1302,12 @@ PACKAGE."
   "Return a list of all symbols in the system having the specified name."
   (let ((string (string string-or-symbol))
         (res ()))
-    (maphash (lambda (k v)
-               (declare (ignore k))
-               (multiple-value-bind (s w) (find-symbol string v)
-                 (when w (pushnew s res))))
-             *package-names*)
+    (with-packages ()
+      (maphash (lambda (k v)
+                 (declare (ignore k))
+                 (multiple-value-bind (s w) (find-symbol string v)
+                   (when w (pushnew s res))))
+               *package-names*))
     res))
 \f
 ;;;; APROPOS and APROPOS-LIST
index 6f8f1a0..f32e656 100644 (file)
 
 ;;; Hash table searching maps a logical pathname's host to its
 ;;; physical pathname translation.
-(defvar *logical-hosts* (make-hash-table :test 'equal))
+(defvar *logical-hosts* (make-hash-table :test 'equal :synchronized t))
 \f
 ;;;; patterns
 
@@ -1338,11 +1338,12 @@ PARSE-NAMESTRING."
 ;;; a new one if necessary.
 (defun intern-logical-host (thing)
   (declare (values logical-host))
-  (or (find-logical-host thing nil)
-      (let* ((name (logical-word-or-lose thing))
-             (new (make-logical-host :name name)))
-        (setf (gethash name *logical-hosts*) new)
-        new)))
+  (with-locked-hash-table (*logical-hosts*)
+    (or (find-logical-host thing nil)
+        (let* ((name (logical-word-or-lose thing))
+               (new (make-logical-host :name name)))
+          (setf (gethash name *logical-hosts*) new)
+          new))))
 \f
 ;;;; logical pathname parsing
 
index d1d72c4..98d52c7 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.11.23"
+"1.0.11.24"