• Post Reply Bookmark Topic Watch Topic
  • New Topic

Process ID of current thread !!!!! URGENT !!!!!!!  RSS feed

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
How can i get the process ID that would be allocated by the JVM to any particular thread ?
ie
i've a java thread which invokes another thread and the INVOKING thread need to know the PROCESS ID of INVOKED thread. That means the invoked thread should return its own process id to the thread that invoked it.
is there any direct method in Java like getProcessID() which can directly return the current thread's process ID or is there any other way thru which i can know this...???
Its urgent.
Thanks in adv.
Meghana
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Meghana,
Threads for a single VM all run in the same process space so their PID will be that of the java interpreter that starts the VM. I don't know of any method that will return the PID although the Process class probably should. It would be a simple matter to write some native code to do it, but of course that would not be a platform independant solution.
Michael Morris
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!