Makefile.am: Added `java/lang/ThreadLocal.java'.
authorAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Wed, 11 Jul 2001 00:47:37 +0000 (17:47 -0700)
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Wed, 11 Jul 2001 00:47:37 +0000 (17:47 -0700)
libjava:

2001-07-10  Alexandre Petit-Bianco  <apbianco@redhat.com>

        * Makefile.am: Added `java/lang/ThreadLocal.java'.
        * Makefile.in: Regenerate.
        * java/lang/ThreadLocal.java: Initial import.

libjava/testsuite:

2001-07-10  Alexandre Petit-Bianco  <apbianco@readhat.com>

        * libjava.lang/TLtest.java: New file.
        * libjava.lang/TLtest.out: New file.

(http://gcc.gnu.org/ml/java-patches/2001-q3/msg00042.html )

From-SVN: r43915

libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in
libjava/java/lang/ThreadLocal.java [new file with mode: 0644]
libjava/testsuite/ChangeLog
libjava/testsuite/libjava.lang/TLtest.java [new file with mode: 0644]
libjava/testsuite/libjava.lang/TLtest.out [new file with mode: 0644]

index 1520449cdcf8b42a09e87382791f91de5204c3e2..08d25674983cbba34f954a50a7fb0d1878c5d312 100644 (file)
@@ -1,3 +1,9 @@
+2001-07-10  Alexandre Petit-Bianco  <apbianco@redhat.com>
+
+       * Makefile.am: Added `java/lang/ThreadLocal.java'.
+       * Makefile.in: Regenerate.
+       * java/lang/ThreadLocal.java: Initial import.
+
 2001-07-07  Jeff Sturm  <jsturm@one-point.com
        
        * Makefile.am (libgcj.jar): Don't recursively make
index cce0bc5ff3cbe372c0dcd5a2878b42447512e895..a0af81a175d90894b692b45c7d1716d9100773cc 100644 (file)
@@ -840,6 +840,7 @@ java/lang/System.java \
 java/lang/Thread.java \
 java/lang/ThreadDeath.java \
 java/lang/ThreadGroup.java \
+java/lang/ThreadLocal.java \
 java/lang/Throwable.java \
 java/lang/UnknownError.java \
 java/lang/UnsatisfiedLinkError.java \
index 2fda05fe69148ecd96981bb156abbf641ec28dad..93f58f62e433e96123c64790f8d5614a4e215690 100644 (file)
@@ -252,7 +252,7 @@ awt_java_source_files =  gnu/awt/LightweightRedirector.java gnu/awt/j2d/Abstract
 built_java_source_files = java/lang/ConcreteProcess.java                           gnu/classpath/Configuration.java
 
 
-core_java_source_files =  java/lang/AbstractMethodError.java java/lang/ArithmeticException.java java/lang/ArrayIndexOutOfBoundsException.java java/lang/ArrayStoreException.java java/lang/Boolean.java java/lang/Byte.java java/lang/Character.java java/lang/ClassCastException.java java/lang/ClassCircularityError.java java/lang/ClassFormatError.java    java/lang/ClassLoader.java java/lang/ClassNotFoundException.java java/lang/CloneNotSupportedException.java java/lang/Cloneable.java java/lang/Comparable.java java/lang/Compiler.java   java/lang/Double.java java/lang/Error.java java/lang/Exception.java java/lang/ExceptionInInitializerError.java java/lang/Float.java java/lang/IllegalAccessError.java java/lang/IllegalAccessException.java java/lang/IllegalArgumentException.java     java/lang/IllegalMonitorStateException.java java/lang/IllegalStateException.java java/lang/IllegalThreadStateException.java java/lang/IncompatibleClassChangeError.java java/lang/IndexOutOfBoundsException.java java/lang/InstantiationError.java java/lang/InstantiationException.java java/lang/Integer.java java/lang/InternalError.java java/lang/InterruptedException.java java/lang/LinkageError.java java/lang/Long.java java/lang/Math.java java/lang/NegativeArraySizeException.java java/lang/NoClassDefFoundError.java java/lang/NoSuchFieldError.java      java/lang/NoSuchFieldException.java java/lang/NoSuchMethodError.java java/lang/NoSuchMethodException.java java/lang/NullPointerException.java java/lang/Number.java java/lang/NumberFormatException.java java/lang/OutOfMemoryError.java        java/lang/Package.java java/lang/Process.java java/lang/Runnable.java   java/lang/Runtime.java java/lang/RuntimeException.java  java/lang/RuntimePermission.java java/lang/SecurityException.java java/lang/SecurityManager.java java/lang/Short.java java/lang/StackOverflowError.java java/lang/String.java java/lang/StringBuffer.java java/lang/StringIndexOutOfBoundsException.java java/lang/System.java java/lang/Thread.java java/lang/ThreadDeath.java java/lang/ThreadGroup.java java/lang/Throwable.java java/lang/UnknownError.java java/lang/UnsatisfiedLinkError.java java/lang/UnsupportedOperationException.java java/lang/VerifyError.java java/lang/VirtualMachineError.java java/lang/Void.java java/io/BufferedInputStream.java java/io/BufferedOutputStream.java java/io/BufferedReader.java java/io/BufferedWriter.java java/io/ByteArrayInputStream.java java/io/ByteArrayOutputStream.java java/io/CharArrayReader.java java/io/CharArrayWriter.java java/io/CharConversionException.java java/io/DataInput.java java/io/DataInputStream.java java/io/DataOutput.java   java/io/DataOutputStream.java java/io/EOFException.java java/io/Externalizable.java java/io/File.java java/io/FileDescriptor.java java/io/FileFilter.java java/io/FileInputStream.java java/io/FileNotFoundException.java java/io/FileOutputStream.java java/io/FilePermission.java java/io/FileReader.java     java/io/FileWriter.java java/io/FilenameFilter.java java/io/FilterInputStream.java java/io/FilterOutputStream.java      java/io/FilterReader.java java/io/FilterWriter.java java/io/IOException.java java/io/InputStream.java java/io/InputStreamReader.java java/io/InterruptedIOException.java java/io/InvalidClassException.java java/io/InvalidObjectException.java java/io/LineNumberInputStream.java java/io/LineNumberReader.java java/io/NotActiveException.java        java/io/NotSerializableException.java java/io/ObjectInput.java java/io/ObjectInputStream.java java/io/ObjectInputValidation.java java/io/ObjectOutput.java java/io/ObjectOutputStream.java      java/io/ObjectStreamClass.java java/io/ObjectStreamConstants.java java/io/ObjectStreamException.java java/io/ObjectStreamField.java java/io/OptionalDataException.java java/io/OutputStream.java java/io/OutputStreamWriter.java        java/io/PipedInputStream.java java/io/PipedOutputStream.java java/io/PipedReader.java java/io/PipedWriter.java java/io/PrintStream.java java/io/PrintWriter.java java/io/PushbackInputStream.java java/io/PushbackReader.java java/io/RandomAccessFile.java java/io/Reader.java java/io/SequenceInputStream.java java/io/Serializable.java java/io/SerializablePermission.java java/io/StreamCorruptedException.java java/io/StreamTokenizer.java java/io/StringBufferInputStream.java java/io/StringReader.java java/io/StringWriter.java java/io/SyncFailedException.java java/io/UTFDataFormatException.java java/io/UnsupportedEncodingException.java java/io/WriteAbortedException.java java/io/Writer.java java/util/AbstractCollection.java java/util/AbstractList.java java/util/AbstractMap.java java/util/AbstractSequentialList.java java/util/AbstractSet.java java/util/ArrayList.java java/util/Arrays.java java/util/BasicMapEntry.java java/util/BitSet.java java/util/Calendar.java    java/util/Collection.java java/util/Collections.java java/util/Comparator.java java/util/ConcurrentModificationException.java java/util/Date.java java/util/Dictionary.java java/util/EmptyStackException.java java/util/Enumeration.java java/util/EventListener.java java/util/EventObject.java java/util/GregorianCalendar.java java/util/HashMap.java java/util/HashSet.java java/util/Hashtable.java java/util/Iterator.java       java/util/LinkedList.java java/util/List.java java/util/ListIterator.java java/util/ListResourceBundle.java java/util/Locale.java java/util/Map.java java/util/MissingResourceException.java    java/util/NoSuchElementException.java java/util/Observable.java java/util/Observer.java java/util/Properties.java java/util/PropertyPermission.java java/util/PropertyResourceBundle.java java/util/Random.java java/util/ResourceBundle.java java/util/Set.java java/util/SimpleTimeZone.java java/util/SortedMap.java java/util/SortedSet.java java/util/Stack.java java/util/StringTokenizer.java java/util/TimeZone.java    java/util/Timer.java java/util/TimerTask.java java/util/TreeMap.java java/util/TreeSet.java java/util/TooManyListenersException.java java/util/Vector.java java/util/WeakHashMap.java
+core_java_source_files =  java/lang/AbstractMethodError.java java/lang/ArithmeticException.java java/lang/ArrayIndexOutOfBoundsException.java java/lang/ArrayStoreException.java java/lang/Boolean.java java/lang/Byte.java java/lang/Character.java java/lang/ClassCastException.java java/lang/ClassCircularityError.java java/lang/ClassFormatError.java    java/lang/ClassLoader.java java/lang/ClassNotFoundException.java java/lang/CloneNotSupportedException.java java/lang/Cloneable.java java/lang/Comparable.java java/lang/Compiler.java   java/lang/Double.java java/lang/Error.java java/lang/Exception.java java/lang/ExceptionInInitializerError.java java/lang/Float.java java/lang/IllegalAccessError.java java/lang/IllegalAccessException.java java/lang/IllegalArgumentException.java     java/lang/IllegalMonitorStateException.java java/lang/IllegalStateException.java java/lang/IllegalThreadStateException.java java/lang/IncompatibleClassChangeError.java java/lang/IndexOutOfBoundsException.java java/lang/InstantiationError.java java/lang/InstantiationException.java java/lang/Integer.java java/lang/InternalError.java java/lang/InterruptedException.java java/lang/LinkageError.java java/lang/Long.java java/lang/Math.java java/lang/NegativeArraySizeException.java java/lang/NoClassDefFoundError.java java/lang/NoSuchFieldError.java      java/lang/NoSuchFieldException.java java/lang/NoSuchMethodError.java java/lang/NoSuchMethodException.java java/lang/NullPointerException.java java/lang/Number.java java/lang/NumberFormatException.java java/lang/OutOfMemoryError.java        java/lang/Package.java java/lang/Process.java java/lang/Runnable.java   java/lang/Runtime.java java/lang/RuntimeException.java  java/lang/RuntimePermission.java java/lang/SecurityException.java java/lang/SecurityManager.java java/lang/Short.java java/lang/StackOverflowError.java java/lang/String.java java/lang/StringBuffer.java java/lang/StringIndexOutOfBoundsException.java java/lang/System.java java/lang/Thread.java java/lang/ThreadDeath.java java/lang/ThreadGroup.java java/lang/ThreadLocal.java java/lang/Throwable.java java/lang/UnknownError.java java/lang/UnsatisfiedLinkError.java java/lang/UnsupportedOperationException.java java/lang/VerifyError.java java/lang/VirtualMachineError.java java/lang/Void.java java/io/BufferedInputStream.java java/io/BufferedOutputStream.java java/io/BufferedReader.java java/io/BufferedWriter.java java/io/ByteArrayInputStream.java java/io/ByteArrayOutputStream.java java/io/CharArrayReader.java java/io/CharArrayWriter.java java/io/CharConversionException.java java/io/DataInput.java java/io/DataInputStream.java java/io/DataOutput.java        java/io/DataOutputStream.java java/io/EOFException.java java/io/Externalizable.java java/io/File.java java/io/FileDescriptor.java java/io/FileFilter.java java/io/FileInputStream.java java/io/FileNotFoundException.java java/io/FileOutputStream.java java/io/FilePermission.java java/io/FileReader.java     java/io/FileWriter.java java/io/FilenameFilter.java java/io/FilterInputStream.java java/io/FilterOutputStream.java      java/io/FilterReader.java java/io/FilterWriter.java java/io/IOException.java java/io/InputStream.java java/io/InputStreamReader.java java/io/InterruptedIOException.java java/io/InvalidClassException.java java/io/InvalidObjectException.java java/io/LineNumberInputStream.java java/io/LineNumberReader.java java/io/NotActiveException.java        java/io/NotSerializableException.java java/io/ObjectInput.java java/io/ObjectInputStream.java java/io/ObjectInputValidation.java java/io/ObjectOutput.java java/io/ObjectOutputStream.java      java/io/ObjectStreamClass.java java/io/ObjectStreamConstants.java java/io/ObjectStreamException.java java/io/ObjectStreamField.java java/io/OptionalDataException.java java/io/OutputStream.java java/io/OutputStreamWriter.java        java/io/PipedInputStream.java java/io/PipedOutputStream.java java/io/PipedReader.java java/io/PipedWriter.java java/io/PrintStream.java java/io/PrintWriter.java java/io/PushbackInputStream.java java/io/PushbackReader.java java/io/RandomAccessFile.java java/io/Reader.java java/io/SequenceInputStream.java java/io/Serializable.java java/io/SerializablePermission.java java/io/StreamCorruptedException.java java/io/StreamTokenizer.java java/io/StringBufferInputStream.java java/io/StringReader.java java/io/StringWriter.java java/io/SyncFailedException.java java/io/UTFDataFormatException.java java/io/UnsupportedEncodingException.java java/io/WriteAbortedException.java java/io/Writer.java java/util/AbstractCollection.java java/util/AbstractList.java java/util/AbstractMap.java java/util/AbstractSequentialList.java java/util/AbstractSet.java java/util/ArrayList.java java/util/Arrays.java java/util/BasicMapEntry.java java/util/BitSet.java java/util/Calendar.java    java/util/Collection.java java/util/Collections.java java/util/Comparator.java java/util/ConcurrentModificationException.java java/util/Date.java java/util/Dictionary.java java/util/EmptyStackException.java java/util/Enumeration.java java/util/EventListener.java java/util/EventObject.java java/util/GregorianCalendar.java java/util/HashMap.java java/util/HashSet.java java/util/Hashtable.java java/util/Iterator.java       java/util/LinkedList.java java/util/List.java java/util/ListIterator.java java/util/ListResourceBundle.java java/util/Locale.java java/util/Map.java java/util/MissingResourceException.java    java/util/NoSuchElementException.java java/util/Observable.java java/util/Observer.java java/util/Properties.java java/util/PropertyPermission.java java/util/PropertyResourceBundle.java java/util/Random.java java/util/ResourceBundle.java java/util/Set.java java/util/SimpleTimeZone.java java/util/SortedMap.java java/util/SortedSet.java java/util/Stack.java java/util/StringTokenizer.java java/util/TimeZone.java    java/util/Timer.java java/util/TimerTask.java java/util/TreeMap.java java/util/TreeSet.java java/util/TooManyListenersException.java java/util/Vector.java java/util/WeakHashMap.java
 
 
 ordinary_java_source_files = $(core_java_source_files) gnu/gcj/RawData.java gnu/gcj/io/DefaultMimeTypes.java gnu/gcj/io/MimeTypes.java gnu/gcj/io/SimpleSHSStream.java gnu/gcj/math/MPN.java gnu/gcj/protocol/file/Connection.java gnu/gcj/protocol/file/Handler.java gnu/gcj/protocol/http/Connection.java gnu/gcj/protocol/http/Handler.java gnu/gcj/protocol/jar/Connection.java gnu/gcj/protocol/jar/Handler.java gnu/gcj/runtime/FileDeleter.java gnu/gcj/runtime/FirstThread.java gnu/gcj/runtime/VMClassLoader.java gnu/gcj/text/BaseBreakIterator.java gnu/gcj/text/CharacterBreakIterator.java gnu/gcj/text/LineBreakIterator.java gnu/gcj/text/LocaleData_en.java    gnu/gcj/text/LocaleData_en_US.java gnu/gcj/text/SentenceBreakIterator.java      gnu/gcj/text/WordBreakIterator.java gnu/gcj/util/EnumerationChain.java gnu/java/io/ClassLoaderObjectInputStream.java gnu/java/io/NullOutputStream.java gnu/java/io/ObjectIdentityWrapper.java gnu/java/lang/ArrayHelper.java gnu/java/lang/ClassHelper.java gnu/java/lang/reflect/TypeSignature.java gnu/java/locale/Calendar.java gnu/java/locale/Calendar_de.java gnu/java/locale/Calendar_en.java gnu/java/locale/Calendar_nl.java gnu/java/security/provider/DefaultPolicy.java gnu/java/security/provider/Gnu.java gnu/java/security/provider/SHA.java gnu/java/security/provider/SHA1PRNG.java java/lang/ref/PhantomReference.java java/lang/ref/Reference.java java/lang/ref/ReferenceQueue.java java/lang/ref/SoftReference.java java/lang/ref/WeakReference.java java/lang/reflect/AccessibleObject.java       java/lang/reflect/Array.java java/lang/reflect/Constructor.java java/lang/reflect/Field.java java/lang/reflect/InvocationTargetException.java java/lang/reflect/Member.java java/lang/reflect/Method.java java/lang/reflect/Modifier.java       java/lang/reflect/ReflectPermission.java java/math/BigDecimal.java java/math/BigInteger.java java/net/BindException.java java/net/ConnectException.java java/net/ContentHandler.java java/net/ContentHandlerFactory.java java/net/DatagramPacket.java java/net/DatagramSocket.java java/net/DatagramSocketImpl.java java/net/FileNameMap.java java/net/HttpURLConnection.java   java/net/InetAddress.java java/net/JarURLConnection.java java/net/MalformedURLException.java java/net/MulticastSocket.java java/net/NetPermission.java java/net/NoRouteToHostException.java java/net/PlainDatagramSocketImpl.java java/net/PlainSocketImpl.java java/net/ProtocolException.java java/net/ServerSocket.java java/net/Socket.java java/net/SocketException.java java/net/SocketImpl.java java/net/SocketImplFactory.java  java/net/SocketOptions.java java/net/SocketPermission.java java/net/URL.java java/net/URLClassLoader.java java/net/URLConnection.java java/net/URLDecoder.java java/net/URLEncoder.java java/net/URLStreamHandler.java java/net/URLStreamHandlerFactory.java java/net/UnknownHostException.java java/net/UnknownServiceException.java java/security/AccessControlContext.java java/security/AccessControlException.java java/security/AccessController.java java/security/AlgorithmParameterGenerator.java java/security/AlgorithmParameters.java java/security/AlgorithmParameterGeneratorSpi.java java/security/AlgorithmParametersSpi.java java/security/AllPermission.java java/security/BasicPermission.java java/security/Certificate.java java/security/CodeSource.java java/security/DigestException.java java/security/DigestOutputStream.java java/security/DummyKeyPairGenerator.java java/security/DummySignature.java java/security/DigestInputStream.java java/security/DomainCombiner.java java/security/DummyMessageDigest.java java/security/GeneralSecurityException.java java/security/Guard.java java/security/GuardedObject.java java/security/Identity.java java/security/IdentityScope.java java/security/InvalidAlgorithmParameterException.java java/security/InvalidKeyException.java java/security/InvalidParameterException.java java/security/Key.java java/security/KeyFactorySpi.java java/security/KeyPairGenerator.java java/security/KeyStoreException.java java/security/KeyException.java java/security/KeyManagementException.java java/security/KeyPairGeneratorSpi.java java/security/KeyStoreSpi.java java/security/KeyFactory.java java/security/KeyPair.java java/security/KeyStore.java java/security/MessageDigest.java java/security/MessageDigestSpi.java java/security/NoSuchAlgorithmException.java java/security/NoSuchProviderException.java java/security/Permission.java java/security/Principal.java java/security/PrivilegedExceptionAction.java java/security/PublicKey.java java/security/PermissionCollection.java java/security/PrivateKey.java java/security/ProtectionDomain.java java/security/Permissions.java java/security/PrivilegedAction.java java/security/Provider.java java/security/Policy.java java/security/PrivilegedActionException.java java/security/ProviderException.java java/security/SecureClassLoader.java java/security/SecureRandomSpi.java java/security/SecurityPermission.java java/security/SignatureException.java java/security/SignedObject.java java/security/SecureRandom.java java/security/Security.java java/security/Signature.java java/security/SignatureSpi.java java/security/Signer.java java/security/UnrecoverableKeyException.java java/security/UnresolvedPermission.java java/security/acl/Acl.java java/security/acl/AclNotFoundException.java java/security/acl/LastOwnerException.java java/security/acl/Owner.java java/security/acl/AclEntry.java java/security/acl/Group.java java/security/acl/NotOwnerException.java java/security/acl/Permission.java java/security/cert/CRL.java java/security/cert/CRLException.java java/security/cert/Certificate.java java/security/cert/CertificateEncodingException.java java/security/cert/CertificateException.java java/security/cert/CertificateExpiredException.java java/security/cert/CertificateFactory.java java/security/cert/CertificateFactorySpi.java java/security/cert/CertificateNotYetValidException.java java/security/cert/CertificateParsingException.java java/security/cert/X509CRL.java java/security/cert/X509CRLEntry.java java/security/cert/X509Certificate.java java/security/cert/X509Extension.java java/security/interfaces/DSAKey.java java/security/interfaces/DSAKeyPairGenerator.java java/security/interfaces/DSAParams.java java/security/interfaces/DSAPrivateKey.java java/security/interfaces/DSAPublicKey.java java/security/interfaces/RSAKey.java java/security/interfaces/RSAPrivateCrtKey.java java/security/interfaces/RSAPrivateKey.java java/security/interfaces/RSAPublicKey.java java/security/spec/AlgorithmParameterSpec.java java/security/spec/DSAParameterSpec.java java/security/spec/DSAPrivateKeySpec.java java/security/spec/DSAPublicKeySpec.java java/security/spec/EncodedKeySpec.java java/security/spec/InvalidKeySpecException.java java/security/spec/InvalidParameterSpecException.java java/security/spec/KeySpec.java java/security/spec/PKCS8EncodedKeySpec.java java/security/spec/RSAKeyGenParameterSpec.java java/security/spec/RSAPrivateCrtKeySpec.java java/security/spec/RSAPrivateKeySpec.java java/security/spec/RSAPublicKeySpec.java java/security/spec/X509EncodedKeySpec.java java/sql/Array.java java/sql/BatchUpdateException.java java/sql/Blob.java java/sql/CallableStatement.java  java/sql/Clob.java java/sql/Connection.java java/sql/DataTruncation.java java/sql/DatabaseMetaData.java java/sql/Date.java java/sql/Driver.java java/sql/DriverManager.java java/sql/DriverPropertyInfo.java java/sql/PreparedStatement.java    java/sql/Ref.java java/sql/ResultSet.java       java/sql/ResultSetMetaData.java java/sql/SQLData.java java/sql/SQLException.java java/sql/SQLInput.java java/sql/SQLOutput.java java/sql/SQLWarning.java java/sql/Statement.java        java/sql/Struct.java    java/sql/Time.java java/sql/Timestamp.java      java/sql/Types.java java/text/BreakIterator.java java/text/CharacterIterator.java java/text/ChoiceFormat.java java/text/CollationElementIterator.java   java/text/CollationKey.java java/text/Collator.java     java/text/DateFormat.java java/text/DateFormatSymbols.java java/text/DecimalFormat.java java/text/DecimalFormatSymbols.java java/text/FieldPosition.java java/text/Format.java java/text/MessageFormat.java java/text/NumberFormat.java java/text/ParseException.java java/text/ParsePosition.java java/text/RuleBasedCollator.java java/text/SimpleDateFormat.java     java/text/StringCharacterIterator.java java/util/jar/Attributes.java java/util/jar/JarEntry.java java/util/jar/JarException.java java/util/jar/JarFile.java java/util/jar/JarInputStream.java java/util/jar/JarOutputStream.java java/util/jar/Manifest.java java/util/zip/Adler32.java java/util/zip/CRC32.java java/util/zip/CheckedInputStream.java java/util/zip/CheckedOutputStream.java java/util/zip/Checksum.java java/util/zip/DataFormatException.java java/util/zip/Deflater.java java/util/zip/DeflaterOutputStream.java    java/util/zip/GZIPInputStream.java java/util/zip/GZIPOutputStream.java java/util/zip/Inflater.java java/util/zip/InflaterInputStream.java java/util/zip/ZipConstants.java       java/util/zip/ZipEntry.java java/util/zip/ZipException.java     java/util/zip/ZipFile.java java/util/zip/ZipInputStream.java java/util/zip/ZipOutputStream.java $(awt_java_source_files) $(convert_source_files)
diff --git a/libjava/java/lang/ThreadLocal.java b/libjava/java/lang/ThreadLocal.java
new file mode 100644 (file)
index 0000000..a0d9d0a
--- /dev/null
@@ -0,0 +1,165 @@
+/* java.lang.ThreadLocal
+   Copyright (C) 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
+
+package java.lang;
+
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ * ThreadLocal objects have a different state associated with every
+ * Thread that accesses them. Every access to the ThreadLocal object
+ * (through the <code>get()</code> and <code>set()</code> methods)
+ * only affects the state of the object as seen by the currently
+ * executing Thread.
+ * <p>
+ * The first time a ThreadLocal object is accessed on a particular
+ * Thread (and no state is associated with that Thread yet)
+ * the state for that Thread is set by executing the method
+ * <code>initialValue()</code>.
+ * <p>
+ * An example how you can use this:
+ * <pre>
+ * class Connection {
+ *     private static ThreadLocal owner = new ThreadLocal() {
+ *        public Object initialValue() {
+ *            return("nobody");
+ *        }
+ *     };
+ * ...
+ * }
+ * </pre>
+ * Now all instances of connection can see who the owner of the currently
+ * executing Thread is by calling <code>owner.get()</code>. By default any
+ * Thread would be associated with 'nobody'. But the Connection object could
+ * offer a method that changes the owner associated with the Thread on
+ * which the method was called by calling <code>owner.put("somebody")</code>.
+ * (Such an owner changing method should then be guarded by security checks.)
+ * <p>
+ * When a Thread is garbage collected all references to values of
+ * the ThreadLocal objects associated with that Thread are removed.
+ *
+ * @since 1.2
+ * @author Mark Wielaard (mark@klomp.org)
+ */
+public class ThreadLocal {
+       
+       /**
+        * Trivial container to wrap the stored values.
+        * Needed to see if the value is null or not yet set.
+        * If it is not yet set we must call intialValue() once.
+        * Package local so InheritableThreadLocal can see it.
+        */
+       final static class Value {
+               final Object value;
+               
+               Value(Object value) {
+                       this.value = value;
+               }
+               
+               Object getValue() {
+                       return value;
+               }
+       }
+       
+       /**
+        * Maps Threads to Values. Uses a WeakHashMap so if a Thread is garbage
+        * collected the reference to the Value will disappear. Only the
+        * <code>set(Thread, Value)</code> and <code>get(Thread)</code> methods
+        * access it. Since this can happen from multiple Threads simultaniously
+        * those methods are synchronized.
+        */
+       private final Map valueMap = new WeakHashMap();
+       
+       /**
+        * Creates a ThreadLocal object without associating any value to it
+        * yet.
+        */
+       public ThreadLocal() {
+       }
+       
+       /**
+        * Gets the value associated with the ThreadLocal object for the
+        * currently executing Thread. If there is no value is associated
+        * with this Thread yet then the valued returned by the
+        * <code>initialValue()</code> method is assosiated with this Thread
+        * and returned.
+        */
+       public Object get() {
+               Thread currentThread = Thread.currentThread();
+               Value v = get(currentThread);
+               if (v == null) {
+                       v = new Value(initialValue());
+                       set(currentThread, v);
+               }
+               return v.getValue();
+       }
+       
+       /**
+        * Gets the Value of this ThreadLocal for a particular Thread.
+        * It is synchronized so the <code>set(Thread, Value)</code> method cannot
+        * simultaniously modify the </code>valueMap</code> from another thread.
+        * Package local so InheritableThreadLocal can access it when a new child
+        * Thread inherits values from its parent Thread.
+        */
+       synchronized final Value get(Thread thread) {
+               return (Value)valueMap.get(thread);
+       }
+       
+       /**
+        * Sets the value associated with the ThreadLocal object for the
+        * currently executing Thread. This overrides any existing value
+        * associated with the current Thread and does not call the
+        * <code>initialValue()</code> method, even if this is the first
+        * time this Thread accesses this ThreadLocal.
+        */
+       public void set(Object value) {
+               Thread currentThread = Thread.currentThread();
+               Value v = new Value(value);
+               set(currentThread, v);
+       }
+       
+       /**
+        * Sets the Value for this ThreadLocal for a particular Thread.
+        * It is synchronized so the <code>get(Thread)</code> method cannot
+        * simultaniously read the </code>valueMap</code> from another thread.
+        * Package local so InheritableThreadLocal can access it when a new child
+        * Thread inherits values from its parent Thread.
+        */
+       synchronized final void set(Thread thread, Value value) {
+               valueMap.put(thread, value);
+       }
+       
+       /**
+        * Called when <code>get()</code> is called and no state is associated
+        * with the currently executing Thread yet.
+        * <p>
+        * The default implementation returns <code>null</code>.
+        */
+       protected Object initialValue() {
+               return null;
+       }
+}
index cc7acc8506e577fc1402cdc93b0418d6bfc0d318..5ab3a0f14a635069c123d7963b0f3528ba74357d 100644 (file)
@@ -1,3 +1,8 @@
+2001-07-10  Alexandre Petit-Bianco  <apbianco@readhat.com>
+
+       * libjava.lang/TLtest.java: New file.
+       * libjava.lang/TLtest.out: New file.
+
 2001-07-06  Andrew Haley  <aph@cambridge.redhat.com>
 
        * libjava.lang/Divide_1.java: Add many more test cases.
diff --git a/libjava/testsuite/libjava.lang/TLtest.java b/libjava/testsuite/libjava.lang/TLtest.java
new file mode 100644 (file)
index 0000000..b7f4115
--- /dev/null
@@ -0,0 +1,60 @@
+class TLtest extends Thread {
+
+    public static void main (String [] args) {
+       Data d = new Data ();
+       new ThreadTest (d, "A").start ();
+       new ThreadTest (d, "B").start ();
+    }
+}
+
+class Data {
+
+    private static ThreadLocal owner = new ThreadLocal () {
+           public Object initialValue () { return ("0"); }
+       };
+    /* A thread will call `set' to set a value it wants an instance
+       of Data to associate with it and only it. */
+    synchronized public void set (String v){owner.set (v);}
+    /* A thread will call `get' to get a value it wants an instance
+       of Data to associate with it and only it. */
+    synchronized public String get (){return (String)owner.get();}
+}
+
+class ThreadTest extends Thread {
+
+    public Data d;
+
+    ThreadTest (Data d, String name) {
+       super (name);
+       this.d = d;
+    }
+
+    public void run () {
+
+       int value = 0;
+       int ref = 0;
+
+       for (int i = 0; i < 20; i++) {
+
+           int rand = (int)(Math.random ()*20);
+
+           /* Read `value', ref is kept for comparison */
+           value = Integer.parseInt (d.get());
+           
+           /* change `value' and ref by a random number, store `value'. */
+           value += rand; ref += rand;
+           d.set (Integer.toString (value));
+
+           try {
+               sleep((int)(Math.random() * 500));
+           } catch (InterruptedException e) {}
+       }
+
+       /* If a thread didn't have private value to attach to the
+          instance of Data, results wouldn't be the same */
+       if (ref == value)
+           System.out.println ("test OK.");
+       else
+           System.out.println ("test failed.");
+    }
+}
diff --git a/libjava/testsuite/libjava.lang/TLtest.out b/libjava/testsuite/libjava.lang/TLtest.out
new file mode 100644 (file)
index 0000000..951592b
--- /dev/null
@@ -0,0 +1,2 @@
+test OK.
+test OK.