JNI Linux Getting process id of child threads

I have a java program that spawns multiple child threads. Inside the child threads i make a native function call to get the process id of the current thread(process in linux) but this return the process id of the main program that spawned the child threads, though the top command shows different process id s, is there any way i can get process id of each thread?

[371 byte] By [balakumara] at [2007-10-3 1:15:48]
# 1
All those threads belong to the same process. So they all have the same process ID.You should check for the thread ID instead.Regards
jfbrierea at 2007-7-14 18:12:57 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
How will i get the thread id?. Is there no way of getting the process id of each thread , i want it so that i can use it to set cpu affinity flags for the threads.Thanks
balakumara at 2007-7-14 18:12:57 > top of Java-index,Java HotSpot Virtual Machine,Specifications...