• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread ID

 
fred rosenberger
lowercase baba
Bartender
Posts: 12342
39
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies if this is the wrong forum.
i'm posting for a colleague who is going on vacation, and i'm not exactly sure what he wants. :-)

So, having said that, here's what he sent me:

Scenario: Using JNI to start the JVM and CallStaticVoidMethod to start one or more applets.

Want: To get a thread id for each "main" in the Native language program; since we know that the PID will be the JVM.

Ideal: To be able to determine which, if any, of the applets is now idle. Again this is to be in the Native program.


I don't think he REALLY means applets - i think he's using the term for "small, helper programs for the larger program"

What i think he is saying is this:

we start up the JVM from a C/C++ program, and makes some calls to start some threads. Ideally, we need to know if the threads are idle. We can get a PID, but that only give us the PID of the JVM, not the threads it spawns. so, can we get the thread ids of the JAVA threads in the C/C++ code, by making some calls?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On JVMs that use native threads -- i.e., these days, most of them -- you can create a thread yourself, and give it to the JVM to use as a Java thread. See http://java.sun.com/docs/books/tutorial/native1.1/invoking/invo.html .
 
fred rosenberger
lowercase baba
Bartender
Posts: 12342
39
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest,

thanks. i've forwarded this on to the person who originally asked the question.

I wish i understood the problem enough to ask better questions!!!

fred
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!