I want to write a c function , which when called by the process returns number of threads created by that process. I want to get the value not by counting but from the kernel structure ? Which structure has this information ?
Asked
Active
Viewed 1,341 times
0
-
http://stackoverflow.com/questions/3475750/posix-api-call-to-list-all-the-pthreads-running-in-a-process ? – user2485710 Nov 20 '13 at 01:51
1 Answers
2
You can get a lot of information about your process by looking in /proc/$$
where $$
is your process ID.The number of threads is available atomically through /proc/$$/status
.
My solution: You need write a function to analyse the file /proc/$$/status to get the number of threads.

BenMorel
- 34,448
- 50
- 182
- 322

BlackMamba
- 10,054
- 7
- 44
- 67