[armedbear-cvs] r12956 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Fri Oct 8 18:03:16 UTC 2010


Author: ehuelsmann
Date: Fri Oct  8 14:03:13 2010
New Revision: 12956

Log:
Make FIND-CLASS use a class which supports non-blocking reading
from a hash: ConcurrentHashMap.

Modified:
   trunk/abcl/src/org/armedbear/lisp/LispClass.java

Modified: trunk/abcl/src/org/armedbear/lisp/LispClass.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispClass.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/LispClass.java	Fri Oct  8 14:03:13 2010
@@ -33,44 +33,34 @@
 
 package org.armedbear.lisp;
 
+import java.util.concurrent.ConcurrentHashMap;
 import static org.armedbear.lisp.Lisp.*;
 
 public abstract class LispClass extends StandardObject
 {
-  private static final EqHashTable map = new EqHashTable(256, NIL, NIL);
+  private static final ConcurrentHashMap<Symbol, LispObject> map
+          = new ConcurrentHashMap<Symbol, LispObject>();
 
   public static LispClass addClass(Symbol symbol, LispClass c)
   {
-    synchronized (map)
-      {
-        map.put(symbol, c);
-      }
+    map.put(symbol, c);
     return c;
   }
 
   public static LispObject addClass(Symbol symbol, LispObject c)
   {
-    synchronized (map)
-      {
-        map.put(symbol, c);
-      }
+    map.put(symbol, c);
     return c;
   }
 
   public static void removeClass(Symbol symbol)
   {
-    synchronized (map)
-      {
-        map.remove(symbol);
-      }
+    map.remove(symbol);
   }
 
   public static LispClass findClass(Symbol symbol)
   {
-    synchronized (map)
-      {
-        return (LispClass) map.get(symbol);
-      }
+    return (LispClass)map.get(symbol);
   }
 
   public static LispObject findClass(LispObject name, boolean errorp)
@@ -78,10 +68,7 @@
   {
     final Symbol symbol = checkSymbol(name);
     final LispObject c;
-    synchronized (map)
-      {
-        c = map.get(symbol);
-      }
+    c = map.get(symbol);
     if (c != null)
       return c;
     if (errorp)




More information about the armedbear-cvs mailing list