15 messages in net.java.dev.jna.userscurrent java thread finding its task ...
FromSent OnAttachments
QuartzOct 27, 2007 7:55 am 
Timothy WallOct 27, 2007 8:14 am 
QuartzOct 27, 2007 11:10 am 
Timothy WallOct 27, 2007 12:54 pm 
QuartzOct 28, 2007 11:03 am 
QuartzOct 28, 2007 12:44 pm 
Timothy WallOct 28, 2007 1:44 pm 
Timothy WallOct 28, 2007 1:49 pm 
Timothy WallOct 28, 2007 1:55 pm 
Timothy WallOct 28, 2007 2:30 pm 
QuartzOct 29, 2007 8:23 am 
Timothy WallOct 29, 2007 1:56 pm 
QuartzOct 29, 2007 7:39 pm 
Timothy WallOct 30, 2007 6:37 am 
QuartzNov 3, 2007 9:39 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:current java thread finding its task id yyyyy in /proc/self/task/yyyyyActions...
From:Quartz (quar@yahoo.com)
Date:Oct 27, 2007 7:55:34 am
List:net.java.dev.jna.users

Hi,

On linux, under the jvm process of pid=xxxxx, threads usually gets listed under /proc/xxxx/tasks/*. I am trying to get the 'yyyyy' number in the proc filesystem for the current jvm
thread, as in /proc/self/task/yyyyy.

As you can see, the jvm pid is not even required since there is a sym link
/proc/self, but there is no such thing for the task id.

So, I don't know enough about the linux programming to drill into jni to pull
this thread id. I was wondering if anyone could tell/show me the thread struct or union that
describes the thread and how to pull the task id with JNA.

I hope to build an api as simple as public int LinuxThreadUtils.getProcessId(); //done: first field of content of
/proc/self/stat public int LinuxThreadUtils.getCurrentThreadTaskId();//TODO

If at all possible, a bonus API would be to get the task id off the current
thread, as in public int LinuxThreadUtils.getThreadTaskId(Thread t);//bonus

Thanks.