If I search for counting the number of threads an application has, all the answers involve external programs like top. I want to count the threads within the ap
top
If you can't read /proc you are a bit in trouble, unless your program communicate with another program which reads /proc
/proc
If you don't want to read /proc because of portability concerns, you might use a library which abstracts that a bit, like libproc does
libproc