Forum > Operating Systems

Ubuntu: How to get pthread_t from tid [was: AV when using pthread_getname_np()]

<< < (2/5) > >>

Pascal:
That was also a point i just checked and realized that the Handle in TDbgLinuxThread is not the handle which was used in pthread_setname_np!

So the new question is: How to obtain the pthread_t handle from the process/thread number which is used in TDbgLinuxThread.Handle?

Pascal:
Or should i use reading "/proc/[pid]/task/[tid]/comm"?

Zvoni:
https://linux.die.net/man/3/pthread_getname_np
If i'm reading this right, the first argument of "pthread_getname_np" is the "Value" returned by "pthread_create" in its first argument (called "thread")
What you call Handle......

Pascal:
Yes, right. The problem i have now is that i only have pid (process_id) and tid (task_id) but i need pthread_id!

MarkMLl:

--- Quote from: Pascal on June 27, 2022, 11:42:38 am ---Or should i use reading "/proc/[pid]/task/[tid]/comm"?

--- End quote ---

Try it, tell us what happens, but don't expect that to be an acceptable final solution.

I'm sure that you appreciate that stuff in /proc and /sys is used heavily when looking at a process "from the outside" during debugging etc., but what you need in this case is a way of recovering the tid at the point of creation... even if it needs the good offices of Sven or Marco to get it into the RTL.

MarkMLl

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version