This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

FirstThread


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]