Hi,
I'm looking for a way to get the light weight process id:s from OpenThreads.
The id:s that I can get from OpenThreads in the current implementation are:
1. getThreadId() - returns an internal thread id. This id is incremented for
each new thread.
2. getProcessId() - returns a pthread_t or pid_t value. In the PThread
implementation this value is fetched by the pthread_create(...) call for
each thread.
One way to get the light weight process id could be to add a variable to the
PThreadPrivateData class and set the value from the StartThread(void *data)
method in PThread.c++:
static void *StartThread(void *data) {
Thread *thread = static_cast<Thread *>(data);
PThreadPrivateData *pd =
static_cast<PThreadPrivateData *>(thread->_prvData);
//Proposed line???
pd->lightWeightProcessId = syscall(__NR_gettid);
...
}
In this case I also need a way to get the id from the Thread class:
int getLightWeightProcessId();
The reason that I want the LWP id:s is that they can be viewed by "ps",
"top" and "ntune".
Is this a viable solution or how should it be implemented in OpenThreads?
... or should it not be a part of OpenThreads?
Regards,
Karl
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org