Ivan Volosyuk wrote:
IMHO, Archie's suggestion is simplier and less intrusive, as the function Thread.attachInternal() can be native function implemented in classlibadapter itself.
But Graeme is correct in that there could be initialization delay. I.e., if we're following the normal rules of Java, all the initialization associated with java.lang.Object, java.lang.String, etc. will have to occur before the very first thread can invoke any methods in java.lang.Thread (even if native). The idea is salvagable if we have a special classlib-specific launcher (i.e., C program using the JNI invocation interface to launch the JVM) which did the very first thread_attach() for the main thread. Then all the other threads could use Thread.attachThread() or whatever without all the initialization delay. Yet another idea (probably not feasible) would be for classlib to: (a) check whether thread_attach() has been called yet for the current thread in any native method that requires this to be so, and if not, go ahead and do it itself (b) store its state in a ThreadLocal (so cleanup would be automatic) This would eliminate the requirement for the VM to be classlib-aware. -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]