[Kaffe] core dump while running kaffe.

Archie Cobbs archie at whistle.com
Tue Mar 23 08:32:10 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.

> > 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.

> > 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.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list