diff options
author | Bryce McKinlay <bryce@gcc.gnu.org> | 2000-11-26 01:48:04 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2000-11-26 01:48:04 +0000 |
commit | 213858c013438c43989052d3f86fb93b2e9b274a (patch) | |
tree | 4eaca964f2a13f025b0393ee000372ef3380e323 /libjava/java/lang/natSystem.cc | |
parent | 3645c4dc1cf004887905411ca81590b75c665529 (diff) | |
download | gcc-213858c013438c43989052d3f86fb93b2e9b274a.zip gcc-213858c013438c43989052d3f86fb93b2e9b274a.tar.gz gcc-213858c013438c43989052d3f86fb93b2e9b274a.tar.bz2 |
System.java (setProperties): Only call init_properties() if properties is null.
2000-11-24 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/System.java (setProperties): Only call init_properties()
if properties is null.
(getProperties): Ditto.
(getProperty): Ditto.
(setProperty): Call init_properties if properties are null.
(prop_init): Remove field.
* java/lang/natSystem.cc (init_properties): Synchronize the entire
method. Check for null properties after synchronizing instead of
prop_init flag. Set the properties field last for thread safety.
* java/io/ObjectInputStream.java (ObjectInputStream): If DEBUG is set,
test for gcj.dumpobjects property and enable object stream dumping
if it is set.
(dumpElement): No longer native.
(dumpElementln): Ditto.
(setDump): Do not define.
* java/io/natObjectInputStream.cc (dumpElement): Removed.
(dumpElementln): Removed.
(setDump): Removed.
2000-11-24 Bryce McKinlay <bryce@albatross.co.nz>
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (built_java_source_files): Add Configuration.java.
* configure.in: Add Configuration.java to CONFIG_FILES. Set
LIBGCJDEBUG substitution if --enable-libgcj-debug is specified.
Create `gnu' directory in the build tree.
* gnu/classpath/Configuration.java.in: New file.
From-SVN: r37749
Diffstat (limited to 'libjava/java/lang/natSystem.cc')
-rw-r--r-- | libjava/java/lang/natSystem.cc | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc index 35198fb..57133fb 100644 --- a/libjava/java/lang/natSystem.cc +++ b/libjava/java/lang/natSystem.cc @@ -217,18 +217,16 @@ getpwuid_adaptor(T_passwd * (*getpwuid_r)(T_uid user_id, T_passwd *pwd_r, void java::lang::System::init_properties (void) { - { - // We only need to synchronize around this gatekeeper. - JvSynchronize sync (&java::lang::System::class$); - if (prop_init) - return; - prop_init = true; - } - - properties = new java::util::Properties (); + JvSynchronize sync (&java::lang::System::class$); + + if (properties != NULL) + return; + + java::util::Properties* newprops = new java::util::Properties (); + // A convenience define. #define SET(Prop,Val) \ - properties->put(JvNewStringLatin1 (Prop), JvNewStringLatin1 (Val)) + newprops->put(JvNewStringLatin1 (Prop), JvNewStringLatin1 (Val)) // A mixture of the Java Product Versioning Specification // (introduced in 1.2), and earlier versioning properties. @@ -351,7 +349,7 @@ java::lang::System::init_properties (void) ; jstring name = JvNewStringLatin1 (p, s - p); jstring val = JvNewStringLatin1 (*s == '=' ? s + 1 : s); - properties->put (name, val); + newprops->put (name, val); } // Set the system properties from the user's environment. @@ -368,13 +366,13 @@ java::lang::System::init_properties (void) } if (_Jv_Jar_Class_Path) - properties->put(JvNewStringLatin1 ("java.class.path"), - JvNewStringLatin1 (_Jv_Jar_Class_Path)); + newprops->put(JvNewStringLatin1 ("java.class.path"), + JvNewStringLatin1 (_Jv_Jar_Class_Path)); else { // FIXME: find libgcj.zip and append its path? char *classpath = ::getenv("CLASSPATH"); - jstring cp = properties->getProperty (JvNewStringLatin1("java.class.path")); + jstring cp = newprops->getProperty (JvNewStringLatin1("java.class.path")); java::lang::StringBuffer *sb = new java::lang::StringBuffer (); if (classpath) @@ -391,7 +389,11 @@ java::lang::System::init_properties (void) else sb->append ((jchar) '.'); - properties->put(JvNewStringLatin1 ("java.class.path"), + newprops->put(JvNewStringLatin1 ("java.class.path"), sb->toString ()); } + // Finally, set the field. This ensures that concurrent getProperty() + // calls will return initialized values without requiring them to be + // synchronized in the common case. + properties = newprops; } |