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

Erik Huelsmann ehuelsmann at common-lisp.net
Sun May 31 11:36:00 UTC 2009


Author: ehuelsmann
Date: Sun May 31 07:35:53 2009
New Revision: 11967

Log:
Fix the wrong thread being reported as the current one.

Note: The error being fixed is that a new LispThread was
  created, regardless of whether there was an initiating
  LispThread already.

Found by: Tobias Rittweiler (tcr in #lisp)


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

Modified: trunk/abcl/src/org/armedbear/lisp/LispThread.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispThread.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/LispThread.java	Sun May 31 07:35:53 2009
@@ -49,9 +49,12 @@
         @Override
         public LispThread initialValue() {
             Thread thisThread = Thread.currentThread();
-            LispThread newThread = new LispThread(thisThread);
-            LispThread.map.put(thisThread,newThread);
-            return newThread;
+            LispThread thread = LispThread.map.get(thisThread);
+            if (thread == null) {
+                thread = new LispThread(thisThread);
+                LispThread.map.put(thisThread,thread);
+            }
+            return thread;
         }
     };
 
@@ -60,7 +63,7 @@
         return threads.get();
     }
 
-   private final Thread javaThread;
+    private final Thread javaThread;
     private boolean destroyed;
     private final LispObject name;
     public SpecialBinding lastSpecialBinding;
@@ -103,6 +106,7 @@
         };
         javaThread = new Thread(r);
         this.name = name;
+        map.put(javaThread, this);
         javaThread.setDaemon(true);
         javaThread.start();
     }




More information about the armedbear-cvs mailing list