diff options
author | Tom Tromey <tromey@gcc.gnu.org> | 2003-08-26 23:14:07 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2003-08-26 23:14:07 +0000 |
commit | 777bb1d4382ddc4aa8c5db3885e276874a470de8 (patch) | |
tree | e8da29583e38e3aa8a01bbb42b15fdc7e764bc52 /libjava/java/lang/ThreadLocal.java | |
parent | 228e7b6256a6d161aa9d45a0319cf7128ae7ad87 (diff) | |
download | gcc-777bb1d4382ddc4aa8c5db3885e276874a470de8.zip gcc-777bb1d4382ddc4aa8c5db3885e276874a470de8.tar.gz gcc-777bb1d4382ddc4aa8c5db3885e276874a470de8.tar.bz2 |
StrictMath.java: Typo fix.
* java/lang/StrictMath.java: Typo fix.
* java/lang/Math.java: Typo fix.
2003-08-26 Stephen Crawley <crawley@dstc.edu.au>
* java/lang/ThreadGroup.java (removeThread): null the 'group' field
of the removed Thread.
2003-08-26 Mark Wielaard <mark@klomp.org>
Reported by David Holmes <dholmes@dltech.com.au>.
* java/lang/InheritableThreadLocal.java (threadMap): Wrap inside
Collections.synchronizedMap.
* java/lang/ThreadLocal.java (valueMap): Likewise.
From-SVN: r70828
Diffstat (limited to 'libjava/java/lang/ThreadLocal.java')
-rw-r--r-- | libjava/java/lang/ThreadLocal.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libjava/java/lang/ThreadLocal.java b/libjava/java/lang/ThreadLocal.java index b5877f5..9725659 100644 --- a/libjava/java/lang/ThreadLocal.java +++ b/libjava/java/lang/ThreadLocal.java @@ -1,5 +1,5 @@ /* ThreadLocal -- a variable with a unique value per thread - Copyright (C) 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,6 +37,7 @@ exception statement from your version. */ package java.lang; +import java.util.Collections; import java.util.Map; import java.util.WeakHashMap; @@ -101,7 +102,7 @@ public class ThreadLocal * <code>set(Thread, Object)</code> and <code>get(Thread)</code> methods * access it. Package visible for use by InheritableThreadLocal. */ - final Map valueMap = new WeakHashMap(); + final Map valueMap = Collections.synchronizedMap(new WeakHashMap()); /** * Creates a ThreadLocal object without associating any value to it yet. @@ -135,7 +136,7 @@ public class ThreadLocal { Thread currentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will - // ever modify the returned value. + // ever modify the returned value and valueMap is a synchronizedMap. Object value = valueMap.get(currentThread); if (value == null) { @@ -156,7 +157,7 @@ public class ThreadLocal public void set(Object value) { // Note that we don't have to synchronize, as only this thread will - // ever modify the returned value. + // ever modify the returned value and valueMap is a synchronizedMap. valueMap.put(Thread.currentThread(), value == null ? NULL : value); } } |