CNI invocation API proposal

Joerg Brunsmann joerg_brunsmann@yahoo.de
Tue Apr 17 10:10:00 GMT 2001


Jeff Sturm <jsturm@one-point.com> wrote:

> >     1. Do we need to attach/detach threads to the GCJ JVM?
>
> To avoid that I would prefer not to have both attach and detach methods,
> but rather a single method that will register the calling thread, execute
> a callback function, then unregister itself, similar to what JvRunMain
> does now (but without spawning a new thread).

To be honest, my simplemindedness doesn't allow me to understand that.
The JvRunMain method looks like this:

void
JvRunMain (jclass klass, int argc, const char **argv)
{
  PROCESS_GCJ_PROPERTIES;

  _Jv_argv = argv;
  _Jv_argc = argc;

  main_init ();
#ifdef HAVE_PROC_SELF_EXE
  char exec_name[20];
  sprintf (exec_name, "/proc/%d/exe", getpid ());
  _Jv_ThisExecutable (exec_name);
#else
  _Jv_ThisExecutable (argv[0]);
#endif

  arg_vec = JvConvertArgv (argc - 1, argv + 1);
  main_thread = new gnu::gcj::runtime::FirstThread (klass, arg_vec);

  main_thread->start();
  _Jv_ThreadWait ();

  int status = (int) java::lang::ThreadGroup::had_uncaught_exception;
    
  java::lang::Runtime::getRuntime ()->_exit (status);
}

Ok, main_init() will be executed only once when the JavaVM is
created. Then the main_thread is created and started which
waits for termination of all other threads.

How would you foresee a method which registers the calling
thread, runs a callback and unregiester itself?

> >     3. Is it possible and reasonable to build a JNI based 
> >        invocation interface upon the CNI based approach?
> 
> I think so, provided you can safely implement attach/detach and
> dynamically load the VM (i.e. dlload libgcj.so).

Do you anticipate high hurdles while realising this approach?

Thanks a lot,

Jörg

__________________________________________________________________
Do You Yahoo!?
Gesendet von Yahoo! Mail - http://mail.yahoo.de



More information about the Java mailing list