Patch for finding and reading property files
Kresten Krab Thorup
krab@daimi.au.dk
Mon Oct 18 02:52:00 GMT 1999
Tom Tromey <tromey@cygnus.com> writes:
> >>>>> "Anthony" == Anthony Green <green@cygnus.com> writes:
>
> Anthony> * java/lang/natClassLoader.cc (redirect): Make static and
> Anthony> remove #ifdef INTERPRETER so it is always defined.
>
> I looked at this code. Shouldn't getSystemClassLoader and
> getVMClassLoader0 be synchronized (on the class)?
> And maybe "redirect" should be a static member of ClassLoader.
>
> Comments? Kresten?
You're right. I think that it suffices to make getVMClassLoader0
synchronized, i.e., make it:
java::lang::ClassLoader*
java::lang::ClassLoader::getVMClassLoader0 ()
{
_Jv_MonitorEnter (&ClassLoaderClass); <<< ADD
if (redirect == 0)
redirect = new gnu::gcj::runtime::VMClassLoader;
_Jv_MonitorExit (&ClassLoaderClass); <<< ADD
return redirect;
}
That way we'll also save synchronization in sucessive invocations of
getSystemClassLoader.
As for making redirect a static member, I think it should be a static
member of VMClassLoader. That's where it fit's naturally, since it
really is "the one and only instance of VMClassLoader". Then,
VMClassLoader should probably have a static member function that
returns the value of redirect.
-- Kresten
Kresten Krab Thorup "I like my eggs ploded"
Department of Computer Science, University of Aarhus
Aabogade 34, DK-8200 Aarhus N, Denmark
+45 8942 5665 (office), +45 2343 4626 (mobile)
More information about the Java-patches
mailing list