This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
FirstThread
- To: java-discuss at sourceware dot cygnus dot com
- Subject: FirstThread
- From: Jeff Sturm <jsturm at sigma6 dot com>
- Date: Tue, 26 Oct 1999 18:28:39 -0400
- Organization: AppNet
I'm taking a look at how libgcj initializes, since I'm considering a
possible invocation API. I see that all Java threads are created within
the runtime, and the main thread simply waits. Besides wasting a
thread, that scheme isn't very convenient for external threads. It will
be a barrier to a complete implementation of JNI.
JNI requires additional thread primitives, "attach" and "detach", to
allow external threads to associate themselves with the runtime and
invoke Java methods. They may later call "detach" when the VM is no
longer needed.
External threads must create a java.lang.Thread object when they attach
to the runtime, and register themselves with the GC so their stacks will
be scanned for pointers. I don't think it would be hard to do this in
libgcj... anybody else see a problem?
--
Jeff Sturm
jsturm@sigma6.com