JavaVM.AttachCurrentThread produces segfault

Enno Brehm kaffe@rufus.w3.org
21 Sep 2001 12:59:22 +0200


Thanks for the quick reply. Well, it helps - at least now I know that I
have to go for the workaround and create my thread on the java side :-).
I definitely agree that kaffe should return an error code (and maybe
some warning message?) when someone tries to use AttachCurrentThread
this way. Unfortunately, right now I don't have the time to dig into the
code and try to fix it myself.

One more question: will it be safe for any thread _already attached_ to
the VM to call this function to get its JNIEnv? That would save me some
work ...

Enno




On Fri, 2001-09-21 at 10:33, Patrick Tullmann wrote:
> > I want to create the thread during some native initialization
> > routine using the pthread-library (my kaffe is compiled to use
> > unix-pthreads). When this thread then wants to call back into java,
> > it tries to attach to the running VM using AttachCurrentThread
> 
> A non-trivial amount of work will have to be done to support
> AttachCurrentThread() in Kaffe.  Some combination of the code in
> jthread_create(), jthread_createfirst(), and tRun() (from
> unix-pthreads/thread-impl.c).  That will take care of the native
> threading side.  I'm not sure what issues (if any) would be associated
> with creating the java.lang.Thread object to go with it (I don't think
> that would be too difficult).
> 
> That said, in the meantime perhaps Kaffe should return a more direct
> error rather than failing to do anything useful.
> 
> Hope this helps some,
> 
> Pat
> 
> ----- ----- ---- ---  ---  --   -    -      -         -              
-
> Pat Tullmann                                      
tullmann@cs.utah.edu
>      To understand recursion one must first understand recursion.