Changeset 12956


Ignore:
Timestamp:
10/08/10 18:03:13 (11 years ago)
Author:
ehuelsmann
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/LispClass.java

    r12576 r12956  
    3434package org.armedbear.lisp;
    3535
     36import java.util.concurrent.ConcurrentHashMap;
    3637import static org.armedbear.lisp.Lisp.*;
    3738
    3839public abstract class LispClass extends StandardObject
    3940{
    40   private static final EqHashTable map = new EqHashTable(256, NIL, NIL);
     41  private static final ConcurrentHashMap<Symbol, LispObject> map
     42          = new ConcurrentHashMap<Symbol, LispObject>();
    4143
    4244  public static LispClass addClass(Symbol symbol, LispClass c)
    4345  {
    44     synchronized (map)
    45       {
    46         map.put(symbol, c);
    47       }
     46    map.put(symbol, c);
    4847    return c;
    4948  }
     
    5150  public static LispObject addClass(Symbol symbol, LispObject c)
    5251  {
    53     synchronized (map)
    54       {
    55         map.put(symbol, c);
    56       }
     52    map.put(symbol, c);
    5753    return c;
    5854  }
     
    6056  public static void removeClass(Symbol symbol)
    6157  {
    62     synchronized (map)
    63       {
    64         map.remove(symbol);
    65       }
     58    map.remove(symbol);
    6659  }
    6760
    6861  public static LispClass findClass(Symbol symbol)
    6962  {
    70     synchronized (map)
    71       {
    72         return (LispClass) map.get(symbol);
    73       }
     63    return (LispClass)map.get(symbol);
    7464  }
    7565
     
    7969    final Symbol symbol = checkSymbol(name);
    8070    final LispObject c;
    81     synchronized (map)
    82       {
    83         c = map.get(symbol);
    84       }
     71    c = map.get(symbol);
    8572    if (c != null)
    8673      return c;
Note: See TracChangeset for help on using the changeset viewer.