[Kaffe] core dump while running kaffe.
Godmar Back
gback at cs.utah.edu
Tue Mar 23 08:39:30 PST 1999
>
> Godmar Back writes:
> > > Right.. but in general native code doesn't know which threading
> > > system is in use (or even which VM is running). So I guess I'm
> > > saying if enterUnsafeRegion() is not the thing it should be using,
> > > what is?
> >
> > In Kaffe, protect your own unsafe stuff with locks/monitors, and
> > protect calls to libc functions with enterUnsafeRegion/leaveUnsafeRegion.
> >
> > In a native threads impl, these functions will be empty stubs, in jthreads,
> > they do what we discussed.
>
> All I'm saying is that it would be nice to write the native code
> independently of the particular threads package kaffe is using.
> So at the least, enterUnsafeRegion() should be a nop if there's
> no need for it.
>
Yes, it should be a nop in this case.
> > > And when you say "native threads", you're assuming what? That each
> > > thread has its own data section? That's usually not the case, is it?
> >
> > No, it's not.
>
> So you would still need to protect a call to (say) strtok(3), which
> internally maintains state using a private static variable.
>
Well, functions that are inherently unsafe because of their interface
you cannot use. That should be clear.
We're only concerned with functions that are not thread-safe because
of their internal implementation.
> > > Or that libc is a reentrant version and routines like strtok(3) are
> > > not being called? I'm fuzzy on the details of native threads.
> >
> > Yes. I do assume that the basic libraries are thread-safe wrt to
> > the native threading system in use.
>
> I'd argue that this assumption is not always true.
>
It is true, or else things are broken.
Note that I'm not claiming that all libraries you use are thread-safe.
A given JNI library may rely on another library that is not thread-safe.
It can use locks to protect it. That's fine.
The case that causes problems is when you provide a library that is
shared by different JNI libraries using it who don't know of each other.
This is the case that I exclude.
As an aside, if anybody's interested in the jdc bug, it's at
http://developer.java.sun.com/developer/bugParade/bugs/4218113.html
- Godmar
More information about the kaffe
mailing list