classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixed small bug in InheritableThreadLocal


From: Mark Wielaard
Subject: Fixed small bug in InheritableThreadLocal
Date: Wed, 3 Oct 2001 00:34:17 +0200
User-agent: Mutt/1.3.22i

Hi,

when adding InheritableThreadLocal to libgcj I found a small bug.
When you would call get() from within an overridden childValue()
method the heritage set would be modified while in the process of
being iterated in the newChildThread() method. This has been
fixed by the following patch which I have checked in.

    * java/lang/InheritableThreadLocal.java (addToHeritage): check if this
      local is already contained in the heritage before adding it.

Cheers,

Mark

-- classpath/classpath/java/lang/InheritableThreadLocal.java    2000/05/30
22:02:34        1.1
+++ classpath/classpath/java/lang/InheritableThreadLocal.java   2001/10/02
22:27:22        1.2
@@ -122,7 +122,9 @@
                                threadMap.put(currentThread, heritage);
                        }
                }
-               heritage.add(this);
+               if (!heritage.contains(this)) {
+                       heritage.add(this);
+               }
        }
        
        /**

-- 
Stuff to read:
    <http://www.toad.com/gnu/whatswrong.html>
  What's Wrong with Copy Protection, by John Gilmore



reply via email to

[Prev in Thread] Current Thread [Next in Thread]