[Kaffe] core dump while running kaffe.
archie at whistle.com
Mon Mar 22 22:34:36 PST 1999
Godmar Back writes:
> > Exactly my point: enterUnsafeRegion() is broken on these other platforms.
> > The semantics should be "block other threads" not "block signals". It
> > should work independent of the underlying threads implementation.
> I disagree. A function to stop all threads already exists in the
> jthread interface. Functions to take locks and spinlocks also exists.
> There's no need to define more.
OK.. as long as native methods can access these routines..
What I'm getting at is: how can independent parties write native
code that safely calls non-reentrant functions (eg, malloc(),
printf()), without knowing anything about the particular threading
system in use?
Since the JNI doesn't specify an answer for this, we should invent
one. That what I was assuming enterUnsafeRegion() would be. Another
possibility is to define a special "non-reentrant native code" lock,
e.g., whenever native code wants to call a non-reentrant routine it
must synchronize on Void.class or something.
> enter/leaveUnsafeRegion is a jthread-specific hack that allows
> single-threaded libraries to be used with jthreads. It is pointless
> for native threads.
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,
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?
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.
> > So.. we need to do the following:
> > (a) Fix/generalize enterUnsafeRegion() so it really works on all platforms
> > (b) Fix the utf8 locking problem
> > If we do (a), then we can use it as a slow solution for (b) until
> > we come up with a different solution.
> I think we can do b) by simply having the gc thread take the utf8lock.
Yes, that seems pretty simple..
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
More information about the kaffe