diff options
| author | Mark Wielaard <mark@gcc.gnu.org> | 2006-01-17 18:09:40 +0000 |
|---|---|---|
| committer | Mark Wielaard <mark@gcc.gnu.org> | 2006-01-17 18:09:40 +0000 |
| commit | 2127637945ea6b763966398130e0770fa993c860 (patch) | |
| tree | c976ca91e3ef0bda3b34b37c0195145638d8d08e /libjava/classpath/java/lang/ThreadLocal.java | |
| parent | bcb36c3e02e3bd2843aad1b9888513dfb5d6e337 (diff) | |
Imported GNU Classpath 0.20
Imported GNU Classpath 0.20
* Makefile.am (AM_CPPFLAGS): Add classpath/include.
* java/nio/charset/spi/CharsetProvider.java: New override file.
* java/security/Security.java: Likewise.
* sources.am: Regenerated.
* Makefile.in: Likewise.
From-SVN: r109831
Diffstat (limited to 'libjava/classpath/java/lang/ThreadLocal.java')
| -rw-r--r-- | libjava/classpath/java/lang/ThreadLocal.java | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/libjava/classpath/java/lang/ThreadLocal.java b/libjava/classpath/java/lang/ThreadLocal.java index bc839044574..aceb2557a54 100644 --- a/libjava/classpath/java/lang/ThreadLocal.java +++ b/libjava/classpath/java/lang/ThreadLocal.java @@ -1,5 +1,5 @@ /* ThreadLocal -- a variable with a unique value per thread - Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2003, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -96,21 +96,6 @@ public class ThreadLocal static final Object NULL = new Object(); /** - * Serves as a key for the Thread.locals WeakHashMap. - * We can't use "this", because a subclass may override equals/hashCode - * and we need to use object identity for the map. - */ - final Key key = new Key(); - - class Key - { - ThreadLocal get() - { - return ThreadLocal.this; - } - } - - /** * Creates a ThreadLocal object without associating any value to it yet. */ public ThreadLocal() @@ -143,11 +128,11 @@ public class ThreadLocal Map map = Thread.getThreadLocals(); // Note that we don't have to synchronize, as only this thread will // ever modify the map. - Object value = map.get(key); + Object value = map.get(this); if (value == null) { value = initialValue(); - map.put(key, value == null ? NULL : value); + map.put(this, value == null ? NULL : value); } return value == NULL ? null : value; } @@ -165,6 +150,6 @@ public class ThreadLocal Map map = Thread.getThreadLocals(); // Note that we don't have to synchronize, as only this thread will // ever modify the map. - map.put(key, value == null ? NULL : value); + map.put(this, value == null ? NULL : value); } } |
