* 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
+2003-08-26 Tom Tromey <tromey@redhat.com>
+
+ * 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.
+
2003-08-26 Mark Wielaard <mark@klomp.org>
* java/security/acl/Acl.java: Fix broken p tag.
/* InheritableThreadLocal -- a ThreadLocal which inherits values across threads
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
package java.lang;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.ArrayList;
+import java.util.Map;
import java.util.WeakHashMap;
/**
* List can be collected, too. Maps to a list in case the user overrides
* equals.
*/
- private static final WeakHashMap threadMap = new WeakHashMap();
+ private static final Map threadMap
+ = Collections.synchronizedMap(new WeakHashMap());
/**
* Creates a new InheritableThreadLocal that has no values associated
{
Thread currentThread = Thread.currentThread();
// Note that we don't have to synchronize, as only this thread will
- // ever modify the returned heritage.
+ // ever modify the returned heritage and threadMap is a synchronizedMap.
List heritage = (List) threadMap.get(currentThread);
if (heritage == null)
{
// The currentThread is the parent of the new thread.
Thread parentThread = Thread.currentThread();
// Note that we don't have to synchronize, as only this thread will
- // ever modify the returned heritage.
+ // ever modify the returned heritage and threadMap is a synchronizedMap.
ArrayList heritage = (ArrayList) threadMap.get(parentThread);
if (heritage != null)
{
/* java.lang.Math -- common mathematical functions, native allowed
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
* double to <code>x / y</code> (ties go to the even n); for a zero
* remainder, the sign is that of <code>x</code>. If either argument is NaN,
* the first argument is infinite, or the second argument is zero, the result
- * is NaN; if x is finite but y is infinte, the result is x. This is
+ * is NaN; if x is finite but y is infinite, the result is x. This is
* accurate within the limits of doubles.
*
* @param x the dividend (the top half)
/* java.lang.StrictMath -- common mathematical functions, strict Java
- Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
* double to <code>x / y</code> (ties go to the even n); for a zero
* remainder, the sign is that of <code>x</code>. If either argument is NaN,
* the first argument is infinite, or the second argument is zero, the result
- * is NaN; if x is finite but y is infinte, the result is x.
+ * is NaN; if x is finite but y is infinite, the result is x.
*
* @param x the dividend (the top half)
* @param y the divisor (the bottom half)
if (groups == null)
return;
threads.remove(t);
+ t.group = null;
// Daemon groups are automatically destroyed when all their threads die.
if (daemon_flag && groups.size() == 0 && threads.size() == 0)
{
/* 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.
package java.lang;
+import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
* <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.
{
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)
{
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);
}
}